We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
gci -v #gci version 0.13.4
you can reproduce with following steps
first we have one go file number.go with Windows line separator: CRLF
number.go
CRLF
package main import ( "math/rand" "fmt" ) func main() { fmt.Println("Number0:", rand.Intn(10)) fmt.Println("Number1:", rand.Intn(10)) fmt.Println("Number2:", rand.Intn(10)) }
usually the go source file with Windows line separator CRLF came from git checkout with setting git config --global core.autocrlf true
git config --global core.autocrlf true
call cat -Ev to show the line endings
cat -Ev
> cat -Ev number.go package main^M$ ^M$ import (^M$ "math/rand"^M$ "fmt"^M$ )^M$ ^M$ func main() {^M$ fmt.Println("Number0:", rand.Intn(10))^M$ fmt.Println("Number1:", rand.Intn(10))^M$ fmt.Println("Number2:", rand.Intn(10))^M$ }^M$
try format this go file with gci, it will replaces all of CR to LF after import package lines.
CR
LF
gci diff number.go
--- number.go +++ number.go @@ -1,12 +1,16 @@ -package main - -import ( - "math/rand" - "fmt" -) - -func main() { - fmt.Println("Number0:", rand.Intn(10)) - fmt.Println("Number1:", rand.Intn(10)) - fmt.Println("Number2:", rand.Intn(10)) -} +package main + +import ( + "fmt" + "math/rand" +) + +func main() { + + fmt.Println("Number0:", rand.Intn(10)) + + fmt.Println("Number1:", rand.Intn(10)) + + fmt.Println("Number2:", rand.Intn(10)) + +}
except correct format result:
--- number.go +++ number.go @@ -1,8 +1,8 @@ package main import ( - "math/rand" "fmt" + "math/rand" ) func main() {
maybe this PR #170 can help.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
gci -v #gci version 0.13.4
you can reproduce with following steps
first we have one go file
number.go
with Windows line separator:CRLF
call
cat -Ev
to show the line endingstry format this go file with gci, it will replaces all of
CR
toLF
after import package lines.except correct format result:
maybe this PR #170 can help.
The text was updated successfully, but these errors were encountered: