Skip to content

x/tools/cmd/goimports: fail to import github.com/nats-io/go-nats-streaming #26164

@powerman

Description

@powerman

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".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions