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
proposal: group standard library imports together in gofmt #27365
Comments
If there are no empty lines in the import statements gofmt works as expected:
|
Is this recent change in "go fmt"? I remember that the result is like what OP expects before. [edit]: Aha, didn't notice "go fmt" support grouping before. Doesn't OP's request has less freedom? |
Similar ideas have been rejected in the past - see #26846. Have you considered proposing this for goimports? It already has functionality to split import groups - see its |
The same issue is present in goimport. If the problem can be fixed there as well that would be great. |
Russ has rejected this for goimports too in #26846.
I doubt anything has changed since then. |
What version of Go are you using (
go version
)?go version go1.11 windows/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\htr\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\htr\go
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\htr\AppData\Local\Temp\go-build186502278=/tmp/go-build -gno-record-gcc-switches
What did you do?
foo.go:
https://play.golang.org/p/GwCJH53FWxV
What did you expect to see?
The import statements should be ordered like:
What did you see instead?
Actual result:
The text was updated successfully, but these errors were encountered: