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/godoc: Path mapping of module name is incorrect #37729

Open
StarpTech opened this issue Mar 7, 2020 · 3 comments
Open

x/tools/cmd/godoc: Path mapping of module name is incorrect #37729

StarpTech opened this issue Mar 7, 2020 · 3 comments
Labels
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

@StarpTech
Copy link

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

go version go1.14 linux/amd64

What version of godoc are you using?

Latest version. Installed with:

GO111MODULE=off go get -u golang.org/x/tools/cmd/godoc

Does this issue reproduce with the latest release?

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

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/starptech/.cache/go-build"
GOENV="/home/starptech/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/starptech/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/mnt/ssd/repositories/golang-dynaday/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-build252071029=/tmp/go-build -gno-record-gcc-switches"

What did you do?

In my organization, we host on Gitlab and projects are namespaced with their "groups". My module and VCS name are git.$organization.com/$group/my-project.

When I run godoc -http=:6060 in root and click on the package git.$organization I see the following error in the terminal:

using module mode; GOMOD=/mnt/ssd/repositories/golang-dynaday/go.mod
2020/03/07 00:03:31 cannot find package "." in:
        /src/$organization

This results in a broken UI and thus my packages aren't listed correctly.
go list -m all list correctly all packages and modules but godoc doesn't display them.

The workaround is to remove $group name from the module name and update all places accordingly. I'm not aware of such a constraint.

go.mod

module git.$org.com/internal/golang-dynaday

go 1.14

replace git.$org.com/internal/golang-dynaday/submodule => ./submodule

require (
	git.$org.com/internal/golang-dynaday/submodule v0.0.0-00010101000000-000000000000
)

What did you expect to see?

I would expect to see all my packages and modules as listed with go list -m all

What did you see instead?

Only one entry with the name of my organization git.$organization.com can be seen in "Third party". It looks like the current implementation can't handle arbitrary module names especially when they can't be mapped to the local filesystem.

According to @dmitshur this can be related to https://golang.org/cl/205661.

Related: #26827

@gopherbot gopherbot added this to the Unreleased milestone Mar 7, 2020
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Mar 7, 2020
@StarpTech
Copy link
Author

@dmitshur I tested your patch but it didn't work. Only the error is gone but the packages are still not recognized.

image

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 7, 2020
@dmitshur
Copy link
Contributor

dmitshur commented Mar 7, 2020

Thanks for the detailed report and testing out that CL.

To clarify, when you write $organization or $group, you mean for those to be substituted by an arbitrary string, such as example or aaa. There isn't a $ character in the import paths, is there?

@StarpTech
Copy link
Author

To clarify, when you write $organization or $group, you mean for those to be substituted by an arbitrary string, such as example or aaa. There isn't a $ character in the import paths, is there?

Yes, arbitrary strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

3 participants