diff --git a/pkg/goformatters/gci/internal/config/config.go b/pkg/goformatters/gci/internal/config/config.go index 30cbf5c67a8e..8140d96bf8c1 100644 --- a/pkg/goformatters/gci/internal/config/config.go +++ b/pkg/goformatters/gci/internal/config/config.go @@ -8,6 +8,7 @@ import ( "github.com/daixiang0/gci/pkg/config" "github.com/daixiang0/gci/pkg/section" + sectioni "github.com/golangci/golangci-lint/pkg/goformatters/gci/internal/section" ) var defaultOrder = map[string]int{ @@ -39,12 +40,12 @@ type YamlConfig struct { func (g YamlConfig) Parse() (*Config, error) { var err error - sections, err := section.Parse(g.SectionStrings) + sections, err := sectioni.Parse(g.SectionStrings) if err != nil { return nil, err } if sections == nil { - sections = section.DefaultSections() + sections = sectioni.DefaultSections() } if err := configureSections(sections, g.ModPath); err != nil { return nil, err @@ -63,7 +64,7 @@ func (g YamlConfig) Parse() (*Config, error) { }) } - sectionSeparators, err := section.Parse(g.SectionSeparatorStrings) + sectionSeparators, err := sectioni.Parse(g.SectionSeparatorStrings) if err != nil { return nil, err } diff --git a/pkg/goformatters/gci/internal/section/section.go b/pkg/goformatters/gci/internal/section/section.go new file mode 100644 index 000000000000..e9c66322256f --- /dev/null +++ b/pkg/goformatters/gci/internal/section/section.go @@ -0,0 +1,7 @@ +package section + +import "github.com/daixiang0/gci/pkg/section" + +func DefaultSections() section.SectionList { + return section.SectionList{Standard{}, section.Default{}} +} diff --git a/pkg/golinters/gci/testdata/gci_go124.go b/pkg/golinters/gci/testdata/gci_go124.go new file mode 100644 index 000000000000..f38c5bd4dab4 --- /dev/null +++ b/pkg/golinters/gci/testdata/gci_go124.go @@ -0,0 +1,16 @@ +//go:build go1.24 + +//golangcitest:args -Egci +//golangcitest:expected_exitcode 0 +package testdata + +import ( + "crypto/sha3" + "errors" + "fmt" +) + +func _() { + fmt.Print(errors.New("x")) + sha3.New224() +}