Skip to content

Commit 726b815

Browse files
build(deps): bump github.com/daixiang0/gci from 0.13.4 to 0.13.5 (#4975)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent 54d089d commit 726b815

File tree

6 files changed

+19
-7
lines changed

6 files changed

+19
-7
lines changed

.golangci.next.reference.yml

+4
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,10 @@ linters-settings:
464464
# Default: false
465465
custom-order: true
466466

467+
# Drops lexical ordering for custom sections.
468+
# Default: false
469+
no-lex-order: true
470+
467471
ginkgolinter:
468472
# Suppress the wrong length assertion warning.
469473
# Default: false

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ require (
3232
github.com/charithe/durationcheck v0.0.10
3333
github.com/ckaznocha/intrange v0.1.2
3434
github.com/curioswitch/go-reassign v0.2.0
35-
github.com/daixiang0/gci v0.13.4
35+
github.com/daixiang0/gci v0.13.5
3636
github.com/denis-tingaikin/go-header v0.5.0
3737
github.com/fatih/color v1.17.0
3838
github.com/firefart/nonamedreturns v1.0.5

go.sum

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonschema/golangci.next.jsonschema.json

+5
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,11 @@
11031103
"description": "Enable custom order of sections.",
11041104
"type": "boolean",
11051105
"default": false
1106+
},
1107+
"no-lex-order": {
1108+
"description": "Drops lexical ordering for custom sections.",
1109+
"type": "boolean",
1110+
"default": false
11061111
}
11071112
}
11081113
},

pkg/config/linters_settings.go

+1
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ type GciSettings struct {
465465
Sections []string `mapstructure:"sections"`
466466
SkipGenerated bool `mapstructure:"skip-generated"`
467467
CustomOrder bool `mapstructure:"custom-order"`
468+
NoLexOrder bool `mapstructure:"no-lex-order"`
468469

469470
// Deprecated: use Sections instead.
470471
LocalPrefixes string `mapstructure:"local-prefixes"`

pkg/golinters/gci/gci.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func New(settings *config.GciSettings) *goanalysis.Linter {
4444
Cfg: gcicfg.BoolConfig{
4545
SkipGenerated: settings.SkipGenerated,
4646
CustomOrder: settings.CustomOrder,
47+
NoLexOrder: settings.NoLexOrder,
4748
},
4849
SectionStrings: settings.Sections,
4950
}
@@ -195,7 +196,7 @@ func diffFormattedFilesToArray(paths []string, cfg gcicfg.Config, diffs *[]strin
195196
}
196197

197198
// Code below this comment is borrowed and modified from gci.
198-
// https://github.com/daixiang0/gci/blob/4725b0c101801e7449530eee2ddb0c72592e3405/pkg/config/config.go
199+
// https://github.com/daixiang0/gci/blob/v0.13.5/pkg/config/config.go
199200

200201
var defaultOrder = map[string]int{
201202
section.StandardType: 0,
@@ -229,10 +230,11 @@ func (g YamlConfig) Parse() (*gcicfg.Config, error) {
229230
sort.Slice(sections, func(i, j int) bool {
230231
sectionI, sectionJ := sections[i].Type(), sections[j].Type()
231232

232-
if strings.Compare(sectionI, sectionJ) == 0 {
233-
return strings.Compare(sections[i].String(), sections[j].String()) < 0
233+
if g.origin.Cfg.NoLexOrder || strings.Compare(sectionI, sectionJ) != 0 {
234+
return defaultOrder[sectionI] < defaultOrder[sectionJ]
234235
}
235-
return defaultOrder[sectionI] < defaultOrder[sectionJ]
236+
237+
return strings.Compare(sections[i].String(), sections[j].String()) < 0
236238
})
237239
}
238240

0 commit comments

Comments
 (0)