Skip to content

x/tools/cmd/goimports: does not associate package name with import paths containing dashes #17546

@xh3b4sd

Description

@xh3b4sd

Please answer these questions before submitting your issue. Thanks!

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

$ go version
go version go1.7.2 darwin/amd64

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

$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/xh3b4sd/.gvm/pkgsets/go1.7.2/global"
GORACE=""
GOROOT="/Users/xh3b4sd/.gvm/gos/go1.7.2"
GOTOOLDIR="/Users/xh3b4sd/.gvm/gos/go1.7.2/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/nd/4mt_ss3s14dblmt_hxkmvr2m0000gn/T/go-build121571538=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

What did you do?

$ goimports -d <package>

What did you expect to see?

I expect nothing to happen because the source code file is properly formatted according to gofmt -d <package>. The package also compiles. So the import paths are correct.

What did you see instead?

goimports -d <package>
diff network/network.go gofmt/network/network.go
--- /var/folders/nd/4mt_ss3s14dblmt_hxkmvr2m0000gn/T/gofmt285977909 2016-10-21 23:06:18.000000000 +0200
+++ /var/folders/nd/4mt_ss3s14dblmt_hxkmvr2m0000gn/T/gofmt872499472 2016-10-21 23:06:18.000000000 +0200
@@ -22,8 +22,6 @@
    "github.com/xh3b4sd/anna/network/forwarder"
    "github.com/xh3b4sd/anna/spec"
    "github.com/xh3b4sd/anna/storage"
-
-   "github.com/xh3b4sd/worker-pool"
 )

 const (
diff network/receiver.go gofmt/network/receiver.go
--- /var/folders/nd/4mt_ss3s14dblmt_hxkmvr2m0000gn/T/gofmt625066799 2016-10-21 23:06:18.000000000 +0200
+++ /var/folders/nd/4mt_ss3s14dblmt_hxkmvr2m0000gn/T/gofmt514423490 2016-10-21 23:06:18.000000000 +0200
@@ -4,17 +4,10 @@
    "github.com/xh3b4sd/anna/clg/divide"
    "github.com/xh3b4sd/anna/clg/greater"
    "github.com/xh3b4sd/anna/clg/input"
-   "github.com/xh3b4sd/anna/clg/is-between"
-   "github.com/xh3b4sd/anna/clg/is-greater"
-   "github.com/xh3b4sd/anna/clg/is-lesser"
    "github.com/xh3b4sd/anna/clg/lesser"
    "github.com/xh3b4sd/anna/clg/multiply"
    "github.com/xh3b4sd/anna/clg/output"
-   "github.com/xh3b4sd/anna/clg/pair-syntactic"
-   "github.com/xh3b4sd/anna/clg/read-information-id"
-   "github.com/xh3b4sd/anna/clg/read-separator"
    "github.com/xh3b4sd/anna/clg/round"
-   "github.com/xh3b4sd/anna/clg/split-features"
    "github.com/xh3b4sd/anna/clg/subtract"
    "github.com/xh3b4sd/anna/clg/sum"
    "github.com/xh3b4sd/anna/spec"

Note that e.g. package github.com/xh3b4sd/worker-pool has a package workerpool declaration. The same applies to the other packages removed. They all define package declarations where the dash is removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions