You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-10
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,16 @@ GCI, a tool that controls golang package import order and makes it always determ
5
5
The desired output format is highly configurable and allows for more custom formatting than `goimport` does.
6
6
7
7
GCI considers a import block based on AST as below:
8
+
8
9
```
9
10
Doc
10
11
Name Path Comment
11
12
```
13
+
12
14
All comments will keep as they were, except the isolated comment blocks.
13
15
14
16
The isolated comment blocks like below:
17
+
15
18
```
16
19
import (
17
20
"fmt"
@@ -78,9 +81,9 @@ Flags:
78
81
-h, --help helpfor write
79
82
-s, --section strings Sections define how inputs will be processed. Section names are case-insensitive and may contain parameters in (). The section order is standard > default > custom > blank > dot. The default value is [standard,default].
80
83
standard - standard section that Golang provides officially, like "fmt"
81
-
Prefix(github.com/daixiang0) - custom section, groups all imports with the specified Prefix. Imports will be matched to the longest Prefix.
84
+
Prefix(github.com/daixiang0) - custom section, groups all imports with the specified Prefix. Imports will be matched to the longest Prefix. Multiple custom prefixes may be provided, they will be rendered as distinct sections separated by newline. You can regroup multiple prefixes by separating them with comma: Prefix(github.com/daixiang0,gitlab.com/daixiang0,daixiang0)
82
85
default - default section, contains all rest imports
83
-
blank - blank section, contains all blank imports. This section is not presed unless explicitly enabled. (default [standard,default])
86
+
blank - blank section, contains all blank imports.
84
87
--skip-generated Skip generated files
85
88
--custom-order Enable custom order of sections. If specified, make the section order the same as your configuration order. The default order is standard > default > custom > blank > dot.
86
89
```
@@ -99,11 +102,11 @@ Flags:
99
102
-d, --debug Enables debug output from the formatter
100
103
-h, --help helpfor write
101
104
-s, --section strings Sections define how inputs will be processed. Section names are case-insensitive and may contain parameters in (). The section order is standard > default > custom > blank > dot. The default value is [standard,default].
102
-
standard - standard section thatolang provides officially, like "fmt"
103
-
Prefix(github.com/daixiang0) - custom section, groups all imports with the specified Prefix. Imports will be matched to the longest Prefix.
105
+
standard - standard section that Golang provides officially, like "fmt"
106
+
Prefix(github.com/daixiang0) - custom section, groups all imports with the specified Prefix. Imports will be matched to the longest Prefix. Multiple custom prefixes may be provided, they will be rendered as distinct sections separated by newline. You can regroup multiple prefixes by separating them with comma: Prefix(github.com/daixiang0,gitlab.com/daixiang0,daixiang0)
104
107
default - default section, contains all rest imports
105
-
blank - blank section, contains all blank imports. This section is not presed unless explicitly enabled.
106
-
dot - dot section, contains all dot imports. This section is not presed unless explicitly enabled. (default [standard,default])
108
+
blank - blank section, contains all blank imports.
109
+
dot - dot section, contains all dot imports.
107
110
--skip-generated Skip generated files
108
111
--custom-order Enable custom order of sections. If specified, make the section order the same as your configuration order. The default order is standard > default > custom > blank > dot.
109
112
```
@@ -119,11 +122,11 @@ Flags:
119
122
-d, --debug Enables debug output from the formatter
120
123
-h, --help helpfor write
121
124
-s, --section strings Sections define how inputs will be processed. Section names are case-insensitive and may contain parameters in (). The section order is standard > default > custom > blank > dot. The default value is [standard,default].
122
-
standard - standard section thatolang provides officially, like "fmt"
123
-
Prefix(github.com/daixiang0) - custom section, groups all imports with the specified Prefix. Imports will be matched to the longest Prefix.
125
+
standard - standard section that Golang provides officially, like "fmt"
126
+
Prefix(github.com/daixiang0) - custom section, groups all imports with the specified Prefix. Imports will be matched to the longest Prefix. Multiple custom prefixes may be provided, they will be rendered as distinct sections separated by newline. You can regroup multiple prefixes by separating them with comma: Prefix(github.com/daixiang0,gitlab.com/daixiang0,daixiang0)
124
127
default - default section, contains all rest imports
125
-
blank - blank section, contains all blank imports. This section is not presed unless explicitly enabled.
126
-
dot - dot section, contains all dot imports. This section is not presed unless explicitly enabled. (default [standard,default])
128
+
blank - blank section, contains all blank imports.
129
+
dot - dot section, contains all dot imports.
127
130
--skip-generated Skip generated files
128
131
--custom-order Enable custom order of sections. If specified, make the section order the same as your configuration order. The default order is standard > default > custom > blank > dot.
Copy file name to clipboardExpand all lines: cmd/gci/gcicommand.go
+4-4
Original file line number
Diff line number
Diff line change
@@ -49,15 +49,15 @@ func (e *Executor) newGciCommand(use, short, long string, aliases []string, stdI
49
49
50
50
sectionHelp:=`Sections define how inputs will be processed. Section names are case-insensitive and may contain parameters in (). The section order is standard > default > custom > blank > dot. The default value is [standard,default].
51
51
standard - standard section that Golang provides officially, like "fmt"
52
-
Prefix(github.com/daixiang0) - custom section, groups all imports with the specified Prefix. Imports will be matched to the longest Prefix.
52
+
Prefix(github.com/daixiang0) - custom section, groups all imports with the specified Prefix. Imports will be matched to the longest Prefix. Multiple custom prefixes may be provided, they will be rendered as distinct sections separated by newline. You can regroup multiple prefixes by separating them with comma: Prefix(github.com/daixiang0,gitlab.com/daixiang0,daixiang0)
53
53
default - default section, contains all rest imports
54
-
blank - blank section, contains all blank imports. This section is not presed unless explicitly enabled.
55
-
dot - dot section, contains all dot imports. This section is not presed unless explicitly enabled.`
54
+
blank - blank section, contains all blank imports.
0 commit comments