Description
The Google-hosted proxy.golang.org
does not smudge git-lfs pointer files in public repos. This results in broken builds when modules include binary syso files that are hosted under git-lfs. (The linker sees a text file instead of the object file, ignores it, then explodes with a lot of missing symbol errors which isn't very intuitive.)
While it might be unreasonable to expect every git extension be supported on proxy.golang.org
, git-lfs is quite common: it's supported by many of the major git hosts (e.g. GitHub, GitLab, Bitbucket, Azure Repos) with many others having a pending feature-request for it.
Workarounds
-
Use
GOPRIVATE
for all packages that need git-lfs. This can result in a complex configuration environment for the developer who now needs to track this across possibly many dependencies, some of which may be transitory. -
The nuclear option: turn off the proxy with
GOPROXY=direct
. -
Change all modules to avoid git-lfs and commit all binary syso files directly into each repo.
None of these options are great...
Similar issues
Issue #41708 talks about a mod checksum mismatch between proxy and direct. One solution is to ignore the smudge and get matching checksums, which can work in that case because the git-lfs file(s) are inconsequential to the build. That approach doesn't work in the scenario described above.
The following issues are related to git-lfs, but aren't as relevant:
- cmd/go: checksum mismatch with private dependent module with GIT LFS files #38941: This is checksum mismatch; but for a private repo (not using
proxy.golang.org
) and where skipping the smudge worked for them. - cmd/go: prune nested modules from git export zipfile #29987: OP wanted to exclude large git-lfs files in a repo that were not consequential for a build, so they put them in a git submodule instead.
- cmd/go: unable to "go get" repository with external LFS server (go modules) #39720:
git archive
didn't smudge git-lfs files usinggo get
. Worked when I tried thegit archive
it on a GitHub repo with git-lfs files... perhaps they have used an old git version?