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/go/packages: unclear how to distinguish test packages #38744

Closed
willfaught opened this issue Apr 29, 2020 · 3 comments
Closed

x/tools/go/packages: unclear how to distinguish test packages #38744

willfaught opened this issue Apr 29, 2020 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@willfaught
Copy link
Contributor

willfaught commented Apr 29, 2020

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

$ go version
go version go1.14.2 darwin/amd64

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="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/Will/Library/Caches/go-build"
GOENV="/Users/Will/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/Will/Developer/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.14.2_1/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.14.2_1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/Will/Developer/turbine/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/bx/qk0phsxd265fqj512dnnpg080000gn/T/go-build418939867=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

$ go doc golang.org/x/tools/go/packages

If you set Config.Tests=true, it isn't clear how to distinguish which package is the test package and which is the normal package. For example, here are the package names and paths for the four Packages returned for the "net/http" query:

  1. http, net/http
  2. main, net/http.test
  3. http, net/http
  4. http_test, net/http_test

Note that 1 and 3 are identical. Since Package IDs are meant to be opaque, according to the doc, I'm at a loss for how to distinguish between these two cases. I could look for GoFiles ending in "_test.go" in each Package, but that seems hacky and requires adding NeedFiles to Config.Mode.

@gopherbot gopherbot added this to the Unreleased milestone Apr 29, 2020
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Apr 29, 2020
@myitcv
Copy link
Member

myitcv commented Apr 29, 2020

cc @matloob

See also #38445 and friends.

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 29, 2020
@matloob
Copy link
Contributor

matloob commented May 1, 2020

Yeah, I think #38445 is the most likely solution to this, if we solve it.

@willfaught
Copy link
Contributor Author

Closing due to no activity.

@willfaught willfaught closed this as not planned Won't fix, can't repro, duplicate, stale Nov 19, 2022
@golang golang locked and limited conversation to collaborators Nov 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants