Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

non-master branches not being recognised #464

Open
mcuadros opened this issue Dec 21, 2016 · 9 comments
Open

non-master branches not being recognised #464

mcuadros opened this issue Dec 21, 2016 · 9 comments

Comments

@mcuadros
Copy link
Contributor

I am trying to generate the documentation for a custom domain: .works but I get a 404:
https://godoc.org/srcd.works/go-billy.v1

@dmitshur
Copy link
Contributor

dmitshur commented Dec 21, 2016

https://gotools.org/srcd.works/go-billy.v1 works okay, so this is indeed a gddo-specific issue.

My first guess was to check validTLDs, but ".works" is present there. In fact, gosrc.IsValidRemotePath("srcd.works/go-billy.v1") returns true:

$ goexec 'gosrc.IsValidRemotePath("srcd.works/go-billy.v1")'
(bool)(true)

So the issue must be elsewhere and will require further investigation. Spinning up a local instance of gddo, or looking in the log entries, is probably the fastest way to figure out what it is.

Edit: Here's some output from trying this on a local instance:

2016/12/21 19:00:52 git ls-remote --heads --tags https://srcd.works/go-billy.v1
2016/12/21 19:00:53 web   fetch: 1860 notfound: Tag or branch not found. srcd.works/go-billy.v1

(This is assuming the latest master version is deployed to production, but I'm pretty sure gosrc package hasn't changed very recently.)

@shantuo
Copy link
Contributor

shantuo commented Dec 21, 2016

gddo uses default "master" tag for custom domain, while yours doesn't have a "master". Maybe we should change the behavior to match "go get"?

@dmitshur
Copy link
Contributor

Maybe we should change the behavior to match "go get"?

I believe we should. I don't see a reason why godoc.org/<import path> shouldn't be able to display documentation for some <import path> that go get <import path> works on.

@mcuadros
Copy link
Contributor Author

@shantuo master is a convention name, what we should get/clone is the commit pointed by the HEAD branch, some packages hosted in github may not have master as default branch and some other even the don't have a master branch. BTW nice catch

I can change go-stable to create a master branch pointing to the same commit pointed by HEAD, but those repositories with non-master branch at github will fail anyways.

@mcuadros mcuadros changed the title .works TLD is not being recognised non-master branches not being recognised Dec 27, 2016
@smasher164
Copy link
Member

Not sure if this is the best place to discuss this, but the behavior of non-master branches not being recognized is also present on go-talks.appspot.com. The getGithubPresentation function under https://github.com/golang/gddo/blob/master/gosrc/github.go#L197 hard-codes master into the url.

@dmitshur
Copy link
Contributor

@smasher164 Given that it uses slightly different code (although also in ./gosrc package), it'd be best to open a separate issue to track that. You can refer to this issue, since it's related.

@raphael
Copy link

raphael commented Dec 8, 2019

The introduction of Go modules is making this issue more critical: I've had to switch the default branch of the Goa repository (github.com/goadesign/goa) to match the branch that contains the latest major version of the Go module (v3). This is to make sure that users looking at the source code see the latest version while maintaining backwards compatibility for users of the pre-existing master branch (which isn't compatible with Go modules). I expected https://godoc.org/goa.design/goa/v3 to work but it doesn't because this Go module only exists in the v3 branch. The net result is that as of today users of Goa cannot see the documentation for the latest version on godoc... The only choice seems to tag the existing master branch, to clobber it with the v3 branch, and to inform all users to use the tag which obviously isn't great. Is my analysis correct? any chance that gddo may support non-master default branches? As mentioned in other comments go get works just fine.

@dmitshur
Copy link
Contributor

dmitshur commented Dec 9, 2019

@raphael For full module support, you should use pkg.go.dev. See golang/go#33654 (comment) for more information about it.

@raphael
Copy link

raphael commented Dec 12, 2019

Great, thank you for the pointer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants