gci icon indicating copy to clipboard operation
gci copied to clipboard

support config the order of sections

Open daixiang0 opened this issue 3 years ago • 2 comments

Now the order of sections is built-in, users cannot change it.

It would be good to support it.

daixiang0 avatar Jul 13 '22 02:07 daixiang0

after 0.4.0, the order is breaking change, which caused most of our code changes.

for example:

we use the command:

(currenly we stick to go install github.com/daixiang0/gci@856d805f8f5cde07e7a6ab29d9034f5bc9a954e4)

yes, our imports org the same af https://github.com/daixiang0/gci/issues/71#issuecomment-1179606162:

  • stdlib
  • default
  • org, non-repo
  • org, repo
 gci write -s Std -s Def -s 'Prefix(code.company.com)' -s 'Prefix(code.company.com/sub1/project)' --SkipGeneratedFiles .

before 0.4.0 gci result: standard

 import(
	"fmt"
 
	"golang.org/x/xerrors"
	"go.uber.org/zap"
 
	"code.company.com/sub1/foo"
 
 
	"code.company.com/sub1/project/bar"
 )

0.4.1

gci write -s standard -s default -s 'Prefix(code.company.com)' -s 'Prefix(code.company.com/sub1/project)' --skip-generated .

will result in:

import(
	"fmt"

	"go.uber.org/zap"
	"golang.org/x/xerrors"

	"code.company.com/sub1/project/bar"
	"code.company.com/sub1/sub2/foo"
)

ttys3 avatar Jul 13 '22 08:07 ttys3

@ttys3 thanks for your report, I will take a look.

daixiang0 avatar Jul 14 '22 12:07 daixiang0