Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
x/tools/cmd/godoc: respect local vendor directory #21939
What version of Go are you using (
Nope, after some more research things aren't working quite as expected.
I've set up a few packages for testing: https://github.com/apiarian/vscode-go-test-docs-main https://github.com/apiarian/vscode-go-test-docs-gopathonly and https://github.com/apiarian/vscode-go-test-docs-vendoroverride
I see the following output:
$ pwd /Users/apasechnik/code/go/src/github.com/apiarian/vscode-go-test-docs-main $ godoc github.com/apiarian/vscode-go-test-docs-vendoroverride use 'godoc cmd/github.com/apiarian/vscode-go-test-docs-vendoroverride' for documentation on the github.com/apiarian/vscode-go-test-docs-vendoroverride command PACKAGE DOCUMENTATION package vendoroverride import "github.com/apiarian/vscode-go-test-docs-vendoroverride" Package vendoroverride in the gopath defines foo and bar with some docs. These will be overridden in the vendor directory of the main package. We could probably do the same with branches or something, but this seems a bit more controllable. FUNCTIONS func Bar() string Bar returns the string "bar" (the gopath version) func Foo() string Foo returns the string "foo" (the gopath version)
Which, is the
Granted, it is possible to do something like this (note the
$ godoc ./vendor/github.com/apiarian/vscode-go-test-docs-vendoroverride PACKAGE DOCUMENTATION package vendoroverride import "./vendor/github.com/apiarian/vscode-go-test-docs-vendoroverride" Package vendoroverride in the gopath defines foo and bar with some docs. These have been overridden in the vendor directory of the main package. We could probably do the same with branches or something, but this seems a bit more controllable. FUNCTIONS func Bar() string Bar returns the string "foo" (the vendor version) func Foo() string Foo returns the string "bar" (the vendor version)
But that puts the burden on the tool which may want to use this
So, I'm reopening this issue to enable local vendor support for the command line form of the
For a bit more context: I'm looking to get docs for a package within my text editor.
I have recently moved from using an app-specific $GOPATH to using
The only workflow change I haven't been able to adjust to is the loss of
When my app had its own $GOPATH, running
Now I'm using
Just to be clear, you want
Because if I see -
It doesn’t need to be automatic. You could certainly pass in a parameter like
The idea is that you can request the godoc for the package by it’s import path and get the correct godoc whether the package is vendored or not.
I agree, I've got a local 'go get' of https://github.com/prometheus/prometheus/, looking to read through the codebase to learn it. (go1.10.3) 'godoc -http=:6060' shows the top-level packages, but no mention of 'vendor'. One of the most important components of this project (tsdb) in under vendor.