-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/cmd/godoc: respect local vendor directory #21939
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
Comments
Maybe with a -include-vendor flag? |
Nope, seems like I was wrong. the vendored code does show up in search results and can be viewed, though it does show the wrong import path (includes the full |
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. Related to zmb3/gogetdoc#29 and microsoft/vscode-go#1237 |
Agreed. 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 |
In the meantime I wrote this wrapper: https://github.com/apiarian/godocv (plus adds |
Just to be clear, you want Because if I see - /cc @andybons |
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'm open to alternatives; the use case is 'I want to see documentation for the version of libraries that will be built into the software I am working on.' |
In general it seems like godoc is going to need to become version-aware (vgo-aware). Not entirely sure what that's going to look like. /cc @alandonovan |
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. |
I believe this is no longer relevant. |
What version of Go are you using (
go version
)?1.9
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
cd $PROJECT_DIRECTORY
godoc -http=:6060
What did you expect to see?
Packages in the
$PROJECT_DIRECTORY/vendor
directory along with things in$GOPATH
and $GOROOT`.What did you see instead?
Only things in
$GOPATH
and$GOROOT
.The text was updated successfully, but these errors were encountered: