-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Milestone
Description
Please answer these questions before submitting your issue. Thanks!
I believe goimports does not automatically include package unsafe even if referenced in the source, which is fine, but when package unsafe is imported it can confuse goimports and produces syntactically correct, but unexpected output, such as:
import (
"reflect"
"unsafe"
)
import "fmt"
- What version of Go are you using (
go version)?
go version go1.6 linux/amd64
- What operating system and processor architecture are you using (
go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GORACE=""
GOROOT="/usr/lib/google-golang"
GOTOOLDIR="/usr/lib/google-golang/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -gno-record-gcc-switches -fdebug-prefix-map=/tmp/go-build262021310=/tmp/go-build"
CXX="g++"
CGO_ENABLED="1"
- What did you do?
Ran goimports on the source code http://play.golang.org/p/Ppc325UINU
package code
import "unsafe"
import "fmt"
var _ = fmt.Print
var _ = unsafe.Sizeof
var _ = reflect.Value
- What did you expect to see?
http://play.golang.org/p/ySR9QrdVlp
package code
import (
"fmt"
"reflect"
"unsafe"
)
var _ = fmt.Print
var _ = unsafe.Sizeof
var _ = reflect.Value
- What did you see instead?
http://play.golang.org/p/i49dfImPxA
package code
import (
"reflect"
"unsafe"
)
import "fmt"
var _ = fmt.Print
var _ = unsafe.Sizeof
var _ = reflect.Value
Reactions are currently unavailable