diff --git a/pkg/analyzer/diff.go b/pkg/analyzer/diff.go index b283cbf..e820757 100644 --- a/pkg/analyzer/diff.go +++ b/pkg/analyzer/diff.go @@ -71,8 +71,8 @@ func GetSuggestedFix(file *token.File, a, b []byte) (*analysis.SuggestedFix, err buf.WriteRune('\n') case '-': // just skip - default: - buf.WriteString(line) + case ' ': + buf.WriteString(line[1:]) buf.WriteRune('\n') } } diff --git a/pkg/analyzer/diff_test.go b/pkg/analyzer/diff_test.go index 617f1e9..5ed9b19 100644 --- a/pkg/analyzer/diff_test.go +++ b/pkg/analyzer/diff_test.go @@ -61,8 +61,8 @@ import ( { Pos: 133, End: 205, - NewText: []byte(` "github.com/daixiang0/gci/pkg/gci" - "github.com/daixiang0/gci/pkg/io" + NewText: []byte(` "github.com/daixiang0/gci/pkg/gci" + "github.com/daixiang0/gci/pkg/io" `, ), }, @@ -93,16 +93,16 @@ import ( { Pos: 35, End: 59, - NewText: []byte(` "go/token" - "strings" + NewText: []byte(` "go/token" + "strings" `, ), }, { Pos: 134, End: 206, - NewText: []byte(` "github.com/daixiang0/gci/pkg/gci" - "github.com/daixiang0/gci/pkg/io" + NewText: []byte(` "github.com/daixiang0/gci/pkg/gci" + "github.com/daixiang0/gci/pkg/io" `, ), },