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

x/tools/gopls: imports differs from goimports #41225

Open
powerman opened this issue Sep 4, 2020 · 0 comments
Open

x/tools/gopls: imports differs from goimports #41225

powerman opened this issue Sep 4, 2020 · 0 comments

Comments

@powerman
Copy link

@powerman powerman commented Sep 4, 2020

What version of Go are you using (go version)?

$ go version
go version go1.15.1 linux/amd64
$ gopls version
golang.org/x/tools/gopls 0.4.4
    golang.org/x/tools/gopls@v0.4.4 h1:8djGYsaZ0ByP0vaXg4T+mnyfDcHpWKSZ+tpQSGv9ahk=

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/powerman/.cache/go-build"
GOENV="/home/powerman/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/powerman/go/pkg/mod"
GONOPROXY="github.com/dentalcpdpro,github.com/mtgroupit,gitlab.qarea.org"
GONOSUMDB="github.com/dentalcpdpro,github.com/mtgroupit,gitlab.qarea.org"
GOOS="linux"
GOPATH="/home/powerman/go"
GOPRIVATE="github.com/dentalcpdpro,github.com/mtgroupit,gitlab.qarea.org"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="x86_64-pc-linux-gnu-gcc"
CXX="x86_64-pc-linux-gnu-g++"
CGO_ENABLED="1"
GOMOD="/home/powerman/tmp/go/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build538437635=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ cat fmt.go 
package main
func F(*testing.T, time.Time) {}
$ gopls imports fmt.go 
package main

import (
	"testing"
	"time"
)
func F(*testing.T, time.Time) {}
$ goimports fmt.go 
package main

import (
	"testing"
	"time"
)

func F(*testing.T, time.Time) {}

What did you expect to see?

Same output as produced by goimports (empty lines around import() block).

What did you see instead?

Empty line only before but not after import() block.

Related: fatih/vim-go#2993

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.