Skip to content

cmd/go: add support for GitHub Enterprise import path #17898

Closed
@matope

Description

@matope

For now, go get does not fetch packages hosted on GitHub Enterprise correctly without any workarounds.

$ go get -v ghe.in.my.company/user/repo/sub
Fetching ghe.in.my.company/user/repo/sub?go-get=1
Parsing meta tags from https://ghe.in.my.company/user/repo/sub?go-get=1 (status code 404)
package ghe.in.my.company/user/repo/sub: unrecognized import path "ghe.in.my.company/user/repo/sub" (parse https://ghe.in.my.company/user/repo/sub?go-get=1: no go-import meta tags)

When I execute go get, it issues an HTTP request to find go-import meta-tags.
But GHE does not return any meta-tag because ghe.in.my.company/user/repo/sub is 404 for GHE ( ghe.in.my.company/user/repo/tree/master/sub would work fine).

So, in order to use golang with GHE, we have to

  • a) Use import path with .vcs. ex) ghe.in.my.company/user/repo.git/sub
  • b) or use a redirect server that attach go-import meta-tags.

But, a) would be a error prone especially for newbies. Many people at first download repo into ghe.in.my.company/user/repo but, after that, go get would download it's sub packages into ghe.in.my.company/user.git/repo. I think this would make people confused.
b) This would work fine, but I think managing a server only for dependency resolution is not very efficient.

So, I think it would be great if cmd/go natively support GitHub Enterprise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions