Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix comment in the end of files #84

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/gci/internal/testdata/comment-in-the-tail.cfg.yaml
13 changes: 13 additions & 0 deletions pkg/gci/internal/testdata/comment-in-the-tail.in.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main
import (
"fmt"

g "github.com/golang"

"github.com/daixiang0/gci"
)


type test int

// test
13 changes: 13 additions & 0 deletions pkg/gci/internal/testdata/comment-in-the-tail.out.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main
import (
"fmt"

g "github.com/golang"

"github.com/daixiang0/gci"
)


type test int

// test
3 changes: 1 addition & 2 deletions pkg/parse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,9 @@ func ParseFile(src []byte) (ImportList, int, int, int, error) {

headEnd, _, _ := getImports(f.Imports[0])
_, tailStart, _ := getImports(f.Imports[len(f.Imports)-1])
tailEnd := f.Decls[len(f.Decls)-1].End()

sort.Sort(data)
return data, headEnd, tailStart, int(tailEnd), nil
return data, headEnd, tailStart, len(src), nil
}

// isGenerated reports whether the source file is generated code.
Expand Down