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
Please answer these questions before submitting your issue. Thanks!
go version
Go 1.8
go env
linux/amd64
This is on the latest version of goimports (golang/tools@8e779ee).
Consider this test program:
package main import ( "time" ) func main() { _ = snappy.Encode _ = unix.Mmap _ = time.Parse }
It's missing two imports. If we run goimports -w fmt.go, we'll get
goimports -w fmt.go
package main import ( "time" "github.com/golang/snappy" "golang.org/x/sys/unix" ) func main() { _ = snappy.Encode _ = unix.Mmap _ = time.Parse }
This is what I expect. However, if we delete the unix import:
package main import ( "time" "github.com/golang/snappy" ) func main() { _ = snappy.Encode _ = unix.Mmap _ = time.Parse }
and then run goimports again, we get this grouping:
package main import ( "time" "golang.org/x/sys/unix" "github.com/golang/snappy" ) func main() { _ = snappy.Encode _ = unix.Mmap _ = time.Parse }
In this second case, I'd expect the file to be the same as the first case instead of introducing a new grouping.
/cc @bradfitz
The text was updated successfully, but these errors were encountered:
I don't have time to work on this myself.
Sorry, something went wrong.
/cc @haya14busa, who did some recent goimports work, in case they'd like to look into it.
Thank you for cc. I think I can work on it.
CL https://golang.org/cl/37552 mentions this issue.
I explained what was the problem and how I fixed it in cl/37552, but the fix is a bit heuristic... It works better for most cases though.
cl/37552 works good as far as I know and the change is small, but I welcome better solution if you find more elegant solution.
golang/tools@84a35ef
No branches or pull requests
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?Go 1.8
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
This is on the latest version of goimports (golang/tools@8e779ee).
Consider this test program:
It's missing two imports. If we run
goimports -w fmt.go
, we'll getThis is what I expect. However, if we delete the unix import:
and then run goimports again, we get this grouping:
In this second case, I'd expect the file to be the same as the first case instead of introducing a new grouping.
/cc @bradfitz
The text was updated successfully, but these errors were encountered: