diff --git a/main.go b/main.go index 84dbf56..f9fc7da 100644 --- a/main.go +++ b/main.go @@ -6,7 +6,7 @@ import ( "github.com/daixiang0/gci/cmd/gci" ) -var version = "0.8.0" +var version = "0.8.1" func main() { e := gci.NewExecutor(version) diff --git a/pkg/gci/gci.go b/pkg/gci/gci.go index 2980e7d..8248866 100644 --- a/pkg/gci/gci.go +++ b/pkg/gci/gci.go @@ -140,7 +140,7 @@ func LoadFormatGoFile(file io.FileObj, cfg config.Config) (src, dist []byte, err } var head []byte - if src[headEnd-1] == '\t' { + if src[headEnd-1] == '\t' || src[headEnd-1] == utils.Linebreak { head = src[:headEnd] } else { // handle multiple import blocks diff --git a/pkg/gci/internal/testdata/no-format.cfg.yaml b/pkg/gci/internal/testdata/no-format.cfg.yaml new file mode 120000 index 0000000..b0db9e7 --- /dev/null +++ b/pkg/gci/internal/testdata/no-format.cfg.yaml @@ -0,0 +1 @@ +common.cfg.yaml \ No newline at end of file diff --git a/pkg/gci/internal/testdata/no-format.in.go b/pkg/gci/internal/testdata/no-format.in.go new file mode 100644 index 0000000..db00247 --- /dev/null +++ b/pkg/gci/internal/testdata/no-format.in.go @@ -0,0 +1,9 @@ +package main + +import ( +"fmt" + +g "github.com/golang" + +"github.com/daixiang0/gci" +) diff --git a/pkg/gci/internal/testdata/no-format.out.go b/pkg/gci/internal/testdata/no-format.out.go new file mode 100644 index 0000000..26a4c1e --- /dev/null +++ b/pkg/gci/internal/testdata/no-format.out.go @@ -0,0 +1,9 @@ +package main + +import ( + "fmt" + + g "github.com/golang" + + "github.com/daixiang0/gci" +) diff --git a/pkg/section/standard_list.go b/pkg/section/standard_list.go index 95c0d22..62decfe 100644 --- a/pkg/section/standard_list.go +++ b/pkg/section/standard_list.go @@ -1,6 +1,6 @@ package section -// Code generated based on go1.19.1. DO NOT EDIT. +// Code generated based on go1.19.2. DO NOT EDIT. var standardPackages = map[string]struct{}{ "archive/tar": {},