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

Package Files links are 404 for packages in GitHub repo subdirs. #484

Closed
dmitshur opened this issue Apr 12, 2017 · 5 comments
Closed

Package Files links are 404 for packages in GitHub repo subdirs. #484

dmitshur opened this issue Apr 12, 2017 · 5 comments
Labels

Comments

@dmitshur
Copy link
Contributor

dmitshur commented Apr 12, 2017

To reproduce, visit:

https://godoc.org/github.com/google/go-querystring/query

Find the "Package Files" link.

image

Clicking it gives 404.

The link is wrong. It points to:

https://github.com/google/go-querystring/tree/query

But it should point to:

https://github.com/google/go-querystring/tree/master/query

Where master is the default branch (which might not necessarily be master).

Cause

It happens only for packages that are in subdirectories, and located on GitHub. The bug is in the gosrc package:

browseURL = expand("https://github.com/{owner}/{repo}/tree{dir}", match)

if match["dir"] != "" {
	browseURL = expand("https://github.com/{owner}/{repo}/tree{dir}", match)
}

It should be something like:

browseURL = expand("https://github.com/{owner}/{repo}/tree/{defaultBranch}{dir}", match)

Where {defaultBranch} is the default branch. I'm not yet sure if we already have access to that value somewhere, or if we need to do something to retrieve it (hopefully, without additional API calls). gosrc.bestTag is definitely relevant here.

@dmitshur dmitshur added the bug label Apr 12, 2017
@dmitshur
Copy link
Contributor Author

dmitshur commented Apr 12, 2017

Related to #464. gddo doesn't have great support for non-master default branches at this time.

Edit: Actually, this is more related to #405. gddo has some support for non-master default branches, but it's specific to github.com and not all import paths.

This bug is actually caused by 7f31cf3, which resolved #405.

@dmitshur
Copy link
Contributor Author

dmitshur commented Apr 12, 2017

I've created CL https://golang.org/cl/40499 that fixes this. I've tested it locally.

Unfortunately, I'm not able to run tests for the current version of this project because it involves external dependencies that I don't have and don't want to install (Cloud SDK). (Also related #470.)

@dmitshur
Copy link
Contributor Author

@shantuo Are you planning to do a redeploy? It doesn't look like the commit that fixed this is live on godoc.org yet.

@shantuo
Copy link
Contributor

shantuo commented Apr 13, 2017

Yes, there was some other issue with the deployment. I will try to cherrypick this change in and redeploy it first.

@dmitshur
Copy link
Contributor Author

I can confirm it's fixed on https://godoc.org now.

The "Package Files" link at https://godoc.org/github.com/google/go-querystring/query, after refreshing the package, points to https://github.com/google/go-querystring/tree/master/query.

Packages will need to be refreshed for the fixed link to take effect. That should happen over time gradually as people push update/refresh.

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

No branches or pull requests

2 participants