Gitea returns import path for organization #3901

Closed
opened 2025-11-02 05:30:03 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @rutgerbrf on GitHub (Sep 5, 2019).

  • Gitea version (or commit ref): 1.9.2
  • Git version: 2.22.0
  • Operating system: Manjaro 18.0.4
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

To quote:

In module mode in Go 1.13, the go command checks all possible module paths in parallel for the requested package.

Gitea returns a non-valid Git fetch URL for e.g. https://try.gitea.io/test, as seen in the example below. This makes it impossible to use Go modules pulling dependencies from a private Gitea instance, because Go 1.13 expects no clone URL if it is not a valid repository path (see GitLab behavior). This issue is related to golang/go#34075. See that issue for more information.

$ curl https://try.gitea.io/test/?go-get=1  
<!doctype html>
<html>
        <head>
                <meta name="go-import" content="try.gitea.io/test git https://try.gitea.io/test/.git">
                <meta name="go-source" content="try.gitea.io/test _ https://try.gitea.io/test/src/branch/master{/dir} https://try.gitea.io/test/src/branch/master{/dir}/{file}#L{line}">
        </head>
        <body>
                go get try.gitea.io/test
        </body>
</html>

But test is an organization and this information should not be added, as it makes it impossible to retrieve dependencies using go get in Go 1.13.

Originally created by @rutgerbrf on GitHub (Sep 5, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.9.2 - Git version: 2.22.0 - Operating system: Manjaro 18.0.4 - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) - [ ] No - [ ] Not relevant ## Description To quote: > In module mode in Go 1.13, the go command checks all possible module paths in parallel for the requested package. Gitea returns a non-valid Git fetch URL for e.g. `https://try.gitea.io/test`, as seen in the example below. This makes it impossible to use Go modules pulling dependencies from a private Gitea instance, because Go 1.13 expects no clone URL if it is not a valid repository path (see GitLab behavior). This issue is related to golang/go#34075. See that issue for more information. ``` $ curl https://try.gitea.io/test/?go-get=1 <!doctype html> <html> <head> <meta name="go-import" content="try.gitea.io/test git https://try.gitea.io/test/.git"> <meta name="go-source" content="try.gitea.io/test _ https://try.gitea.io/test/src/branch/master{/dir} https://try.gitea.io/test/src/branch/master{/dir}/{file}#L{line}"> </head> <body> go get try.gitea.io/test </body> </html> ``` But test is an organization and this information should not be added, as it makes it impossible to retrieve dependencies using go get in Go 1.13.
GiteaMirror added the type/bug label 2025-11-02 05:30:03 -06:00
Author
Owner

@rutgerbrf commented on GitHub (Sep 5, 2019):

There is some code which could be used in https://github.com/profects/gitea/tree/fix-go1.13-invalid-import-path, and I will probably create a merge request sometime soon. It would be nice if this issue could be fixed in a 1.9 minor release. The fix in this branch currently works for us, but I have not tried to run the test suite yet.

@rutgerbrf commented on GitHub (Sep 5, 2019): There is some code which could be used in https://github.com/profects/gitea/tree/fix-go1.13-invalid-import-path, and I will probably create a merge request sometime soon. It would be nice if this issue could be fixed in a 1.9 minor release. The fix in this branch currently works for us, but I have not tried to run the test suite yet.
Author
Owner

@lunny commented on GitHub (Sep 5, 2019):

@rutgerbrf Please.

@lunny commented on GitHub (Sep 5, 2019): @rutgerbrf Please.
Author
Owner

@ghost commented on GitHub (Sep 5, 2019):

Just a + here to increase the pressure! ;)

@ghost commented on GitHub (Sep 5, 2019): Just a + here to increase the pressure! ;)
Author
Owner

@lunny commented on GitHub (Sep 5, 2019):

@rutgerbrf I can confirm that your patch works.

@lunny commented on GitHub (Sep 5, 2019): @rutgerbrf I can confirm that your patch works.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3901