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/cmd/goimports: fail to import github.com/nats-io/go-nats-streaming #26164

Closed
powerman opened this issue Jun 30, 2018 · 1 comment
Closed
Milestone

Comments

@powerman
Copy link

@powerman powerman commented Jun 30, 2018

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

go version go1.10.3 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/powerman/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/powerman/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="x86_64-pc-linux-gnu-gcc"
CXX="x86_64-pc-linux-gnu-g++"
CGO_ENABLED="1"
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-build239447745=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ ls
main.go
$ go build                                                                              
# powerman/nss
./main.go:4:2: undefined: stan
$ goimports main.go                                                                     
package main

func main() {
	stan.Connect("test-cluster", "test-client")
}
$ sed -i '1aimport "github.com/nats-io/go-nats-streaming"' main.go
$ go build
$ cat main.go                                                                           
package main
import "github.com/nats-io/go-nats-streaming"

func main() {
	stan.Connect("test-cluster", "test-client")
}

What did you expect to see?

goimports should add this import.

What did you see instead?

goimports did nothing. Probably because package name "stan" has nothing with import path "github.com/nats-io/go-nats-streaming".

@gopherbot gopherbot added this to the Unreleased milestone Jun 30, 2018
@josharian
Copy link
Contributor

@josharian josharian commented Jul 2, 2018

Probably because package name "stan" has nothing with import path "github.com/nats-io/go-nats-streaming".

That’s it, exactly. This is a very significant performance optimization; this is working as intended. Thanks for filing a bug to make sure, though.

@josharian josharian closed this Jul 2, 2018
@golang golang locked and limited conversation to collaborators Jul 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
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.