We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent223ff51 commitdb7f62bCopy full SHA for db7f62b
pkg/goformatters/gci/gci.go
@@ -2,6 +2,7 @@ package gci
2
3
import (
4
"context"
5
+"go/format"
6
7
gcicfg"github.com/daixiang0/gci/pkg/config"
8
"github.com/daixiang0/gci/pkg/gci"
@@ -60,5 +61,14 @@ func (*Formatter) Name() string {
60
61
62
func (f*Formatter)Format(filenamestring,src []byte) ([]byte,error) {
63
_,formatted,err:=gci.LoadFormat(src,filename,*f.config)
-returnformatted,err
64
+iferr!=nil {
65
+returnnil,err
66
+}
67
+
68
+// gci format the code only when the imports are modified,
69
+// this produced inconsistencies.
70
+// To be always consistent, the code should always be formatted.
71
+// https://github.com/daixiang0/gci/blob/c4f689991095c0e54843dca76fb9c3bad58ec5c7/pkg/gci/gci.go#L148-L151
72
+// https://github.com/daixiang0/gci/blob/c4f689991095c0e54843dca76fb9c3bad58ec5c7/pkg/gci/gci.go#L215
73
+returnformat.Source(formatted)
74
}