Make go packages from subdirectories on gitea instances installable with "go get" #638

Closed
opened 2025-11-02 03:31:10 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @jcgruenhage on GitHub (Apr 11, 2017).

Currently, you can't fetch go projects from gitea, without the .git extension. This causes the binaries to have this ugly .git extension too and prevents people from fetching projects from subdirectories.

Documentation of meta-tags: https://golang.org/cmd/go/#hdr-Remote_import_paths
The PR and commit that fixed this in gitlab: https://github.com/gitlabhq/gitlabhq/pull/7693 https://github.com/gitlabhq/gitlabhq/commit/e23d6ada1c234acd45b676a34a2997aeae94d087

Originally created by @jcgruenhage on GitHub (Apr 11, 2017). Currently, you can't fetch go projects from gitea, without the .git extension. This causes the binaries to have this ugly .git extension too and prevents people from fetching projects from subdirectories. Documentation of meta-tags: https://golang.org/cmd/go/#hdr-Remote_import_paths The PR and commit that fixed this in gitlab: https://github.com/gitlabhq/gitlabhq/pull/7693 https://github.com/gitlabhq/gitlabhq/commit/e23d6ada1c234acd45b676a34a2997aeae94d087
GiteaMirror added the type/bug label 2025-11-02 03:31:10 -06:00
Author
Owner

@jcgruenhage commented on GitHub (Apr 13, 2017):

Since this affects me more than I thought, I've decided to start looking into it. I've found that the header file in the base template folder already contains a meta tag for that, but that doesn't work, because somehow {{.GoGetImport}} doesn't start with the domain, but with localhost instead.

@jcgruenhage commented on GitHub (Apr 13, 2017): Since this affects me more than I thought, I've decided to start looking into it. I've found that the header file in the base template folder already contains a meta tag for that, but that doesn't work, because somehow {{.GoGetImport}} doesn't start with the domain, but with localhost instead.
Author
Owner

@lunny commented on GitHub (Apr 20, 2017):

@jcgruenhage any news?

@lunny commented on GitHub (Apr 20, 2017): @jcgruenhage any news?
Author
Owner

@lunny commented on GitHub (Apr 20, 2017):

I test go get git.lunny.info/lunny/tango. There is no problem. I found that you have to add DOMAIN = <your domain> on your custom/conf/app.ini before SSH_DOMAIN to let it work.

@lunny commented on GitHub (Apr 20, 2017): I test `go get git.lunny.info/lunny/tango`. There is no problem. I found that you have to add `DOMAIN = <your domain>` on your custom/conf/app.ini before `SSH_DOMAIN` to let it work.
Author
Owner

@jcgruenhage commented on GitHub (Apr 20, 2017):

I've changed the title. If the root directory is the go project you want to get, there is no problem, but if you want to get something in a subdirectory, that does not work, since the 404 page does not contain the appropriate meta tags.

@jcgruenhage commented on GitHub (Apr 20, 2017): I've changed the title. If the root directory is the go project you want to get, there is no problem, but if you want to get something in a subdirectory, that does not work, since the 404 page does not contain the appropriate meta tags.
Author
Owner

@jcgruenhage commented on GitHub (Apr 20, 2017):

Works:

go get git.host.tld/user/repo

Doesn't work:

go get git.host.tld/user/repo/subdir

Workaround:

Clone the repo into $GOPATH/src/git.host.tld/user/repo first.

@jcgruenhage commented on GitHub (Apr 20, 2017): ## Works: ```go get git.host.tld/user/repo``` ## Doesn't work: ```go get git.host.tld/user/repo/subdir``` ### Workaround: Clone the repo into ```$GOPATH/src/git.host.tld/user/repo``` first.
Author
Owner

@lunny commented on GitHub (Apr 20, 2017):

#1518 should fix go get git.host.tld/user/repo/subdir have you tried that?

@lunny commented on GitHub (Apr 20, 2017): #1518 should fix `go get git.host.tld/user/repo/subdir` have you tried that?
Author
Owner

@jcgruenhage commented on GitHub (Apr 20, 2017):

I am not sure why, but it seems to work.. I didn't think that that HTTP func was actually called when serving a 404..

@jcgruenhage commented on GitHub (Apr 20, 2017): I am not sure why, but it seems to work.. I didn't think that that HTTP func was actually called when serving a 404..
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#638