@@ -44,6 +44,7 @@ func New(settings *config.GciSettings) *goanalysis.Linter { |
|
|
44 |
44 |
Cfg: gcicfg.BoolConfig{ |
45 |
45 |
SkipGenerated: settings.SkipGenerated, |
46 |
46 |
CustomOrder: settings.CustomOrder, |
|
47 |
+NoLexOrder: settings.NoLexOrder, |
47 |
48 |
}, |
48 |
49 |
SectionStrings: settings.Sections, |
49 |
50 |
} |
@@ -195,7 +196,7 @@ func diffFormattedFilesToArray(paths []string, cfg gcicfg.Config, diffs *[]strin |
|
|
195 |
196 |
} |
196 |
197 |
|
197 |
198 |
// 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 |
199 |
200 |
|
200 |
201 |
var defaultOrder = map[string]int{ |
201 |
202 |
section.StandardType: 0, |
@@ -229,10 +230,11 @@ func (g YamlConfig) Parse() (*gcicfg.Config, error) { |
|
|
229 |
230 |
sort.Slice(sections, func(i, j int) bool { |
230 |
231 |
sectionI, sectionJ := sections[i].Type(), sections[j].Type() |
231 |
232 |
|
232 |
|
-if strings.Compare(sectionI, sectionJ) == 0 { |
233 |
|
-return strings.Compare(sections[i].String(), sections[j].String()) < 0 |
|
233 |
+if g.origin.Cfg.NoLexOrder | |
|
234 |
+return defaultOrder[sectionI] < defaultOrder[sectionJ] |
234 |
235 |
} |
235 |
|
-return defaultOrder[sectionI] < defaultOrder[sectionJ] |
|
236 |
+ |
|
237 |
+return strings.Compare(sections[i].String(), sections[j].String()) < 0 |
236 |
238 |
}) |
237 |
239 |
} |
238 |
240 |
|