Open campbellr opened 4 years ago
/cc @bcmills @jayconrod @matloob
Related #25605, especially this comment.
For posterity: I think that any repositories being built by vgo depend on a Git LFS object during compilation will fail, since those objects will not be checked out, (because the repository is bare). That's a limitation of git-archive(1) and Git LFS, but not vgo.
tbh, I wasn't sure if this was more appropriate as a git-lfs
or git-archive
issue rather than a Go issue, but I ended up filing it here because:
go get
, which works as expectedgo get
cloning the repo in an "unexpected" way. I'm sure there is a good reason for it, but it does seem break assumptions that git-lfs
(and possibly other tools?) seems to depend on.See also #29987 (also related to LFS).
See also https://github.com/golang/go/issues/38941#issuecomment-626754044 (somehow related to git-lfs smudging).
This issue is four years old. Why isn't this fixed yet?
@pebbe This is open source software and this is not a common case. If you are running into this I would encourage you to send in a patch. See https://go.dev/doc/contribute. Thanks.
@pebbe This is open source software and this is not a common case. If you are running into this I would encourage you to send in a patch. See https://go.dev/doc/contribute. Thanks.
I don't have the expertise to fix go get
.
This is weird. I have this file main.go
:
package main
import (
"fmt"
"github.com/pebbe/tokenize"
)
func main() {
s, err := tokenize.Dutch("Dit is een test. En dit, misschien?", true)
fmt.Println(err)
fmt.Println(s)
}
I try to build this (Go version 1.23.0), but it fails because of lfs:
$ go mod init local
go: creating new go.mod: module local
go: to add module requirements and sums:
go mod tidy
$ go mod tidy
go: finding module for package github.com/pebbe/tokenize
go: downloading github.com/pebbe/tokenize v1.0.4
go: found github.com/pebbe/tokenize in github.com/pebbe/tokenize v1.0.4
$ go build .
# github.com/pebbe/tokenize
libtok1.c:1:1: error: unknown type name ‘version’
1 | version https://git-lfs.github.com/spec/v1
| ^~~~~~~
libtok1.c:1:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
1 | version https://git-lfs.github.com/spec/v1
| ^
libtok1.c:2:12: error: invalid suffix "c540c13c58219a3aac14ed2bf7c1b6396664268f3abc0f8f94d8374b889882" on integer constant
2 | oid sha256:90c540c13c58219a3aac14ed2bf7c1b6396664268f3abc0f8f94d8374b889882
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Let's begin again:
$ go clean -cache -modcache
$ rm go.*
I set this variable, but I don't know what this is suppose to change:
$ export GOPRIVATE=github.com/pebbe/tokenize
Now try again. It works. I notice that go mod tidy
now takes much more time to complete.
$ export GOPRIVATE=github.com/pebbe/tokenize
$ go mod init local
go: creating new go.mod: module local
go: to add module requirements and sums:
go mod tidy
$ go mod tidy
go: finding module for package github.com/pebbe/tokenize
go: downloading github.com/pebbe/tokenize v1.0.4
go: found github.com/pebbe/tokenize in github.com/pebbe/tokenize v1.0.4
$ go build .
$ ./local
<nil>
Dit is een test .
En dit , misschien ?
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I have a repository that use Git LFS, with a external LFS server configured via a
.lfsconfig
file in the root of the repository (docs).When I attempt to
go get
a package in this repo in "module-aware mode", it fails with the following error:As far as I can tell, the problem seems to be due to the way that
go get
clones the git repository.git init --bare
git remote add origin github.com/campbellr/goproject
git fetch
git archive
thepackage/
directorySince
git archive
is running in a bare repository, there is no.lfsconfig
, sogit-lfs
doesn't fetch the objects from the right lfs server and gets a 404.Note that the same
go get
will succeed inGOPATH
mode (since it just does a normalgit clone
)