Skip to content

Commit 87c030f

Browse files
authored
fix comment before import blocks (#147)
Signed-off-by: Loong <[email protected]>
1 parent d6e755b commit 87c030f

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

pkg/gci/gci.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func LoadFormatGoFile(file io.FileObj, cfg config.Config) (src, dist []byte, err
146146
// order by section list
147147
for _, s := range cfg.Sections {
148148
if len(result[s.String()]) > 0 {
149-
if body != nil && len(body) > 0 {
149+
if len(body) > 0 {
150150
body = append(body, utils.Linebreak)
151151
}
152152
for _, d := range result[s.String()] {
@@ -161,7 +161,6 @@ func LoadFormatGoFile(file io.FileObj, cfg config.Config) (src, dist []byte, err
161161
tail := make([]byte, len(src)-tailStart)
162162
copy(tail, src[tailStart:])
163163

164-
head = append(head, utils.Linebreak)
165164
// ensure C
166165
if cStart != 0 {
167166
head = append(head, src[cStart:cEnd]...)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
common.cfg.yaml
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package main
2+
3+
// comment
4+
import (
5+
"fmt"
6+
"os"
7+
8+
"github.com/daixiang0/gci"
9+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package main
2+
3+
// comment
4+
import (
5+
"fmt"
6+
"os"
7+
8+
"github.com/daixiang0/gci"
9+
)

0 commit comments

Comments
 (0)