Skip to content

"go get" command fails to checkout master #4574

Description

@RochaStratovan

Describe the bug
The installation wiki has provides instructions for obtaining the git-lfs source code. These instructions are:

Building requires a standard Unix environment with GNU make and bash. On Windows, > you should install GNU make (e.g., via Chocolatey) and build under Git Bash.

  1. Ensure that you have a reasonably modern version of Go.
  2. If you are using Windows, build goversioninfo (e.g., with go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo) and place the binary in your PATH.
  3. Obtain a copy of the repository, either with git clone (into the appropriate location within your $GOPATH), or with go get, i.e., go get github.com/git-lfs/git-lfs.
  4. In your copy of the source, execute make to ensure that you are able to build a fresh copy of Git LFS. If successful, the binary will appear in bin/git-lfs.

When I use the go get line

go get github.com/git-lfs/git-lfs

It fails with the following message:

-bash-4.2# go get github.com/git-lfs/git-lfs
# cd /tmp/gitlfs/src/github.com/git-lfs/git-lfs; git checkout master
error: pathspec 'master' did not match any file(s) known to git.
package github.com/git-lfs/git-lfs: exit status 1

System environment

  • Fedora 20
  • Latest go
    -bash-4.2# go version
    go version go1.4.2 linux/amd64
    

Activity

  1. RochaStratovan commented on Aug 9, 2021

    @RochaStratovan
    Author

    Go version 1.4.2 is the latest that is available via the yum command.

    I found that I could download a newer go binary from here and follow their install instructions.

    After that the go get command still failed.

    HOWEVER if I did git clone followed by make that now worked (previously that failed on go too).

  2. chrisd8088 commented on Aug 10, 2021

    @chrisd8088
    Member

    Hey, thanks for the report. There do seem to be some problems with how Go's proxy.golang.org service is caching this project's releases. For instance, the current output from https://proxy.golang.org/github.com/git-lfs/git-lfs/@v/list stops at v2.5.2 (before our primary branch was renamed to 'main'). Among other consequences, it means the https://pkg.go.dev/github.com/git-lfs/git-lfs page is also very stale.

    Specifying the correct latest version and requesting https://sum.golang.org/lookup/github.com/git-lfs/[email protected] we get:

    invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2
    

    which leads us to golang/go#35732, and from there to a few other projects whose solutions to this error message appear to be to add /v[n] to their module path. In this project's case that would mean we need to change the module path in our go.mod file from:

    module github.com/git-lfs/git-lfs
    

    to:

    module github.com/git-lfs/git-lfs/v2
    

    and then make any other related changes to get everything building again. That would seem to track with the fact that v2.6.0 (the next release tag after v2.5.2) was the first one where go.mod was introduced, back in #3208.

  3. bk2204 commented on Aug 10, 2021

    @bk2204
    Member

    I'm not sure that making the version change is going to help here. For example, using Go 1.15, I don't have a problem running go get github.com/git-lfs/git-lfs. It may be that some versions of Go hard-code master as their branch in the list, which is what @RochaStratovan is seeing here. Fedora 20 is also way past end of life and we know for certain Go 1.4 won't work at all, so I'm not surprised things are totally broken there.

    I'm also not excited about changing the import path. We're a binary and not a module, and we don't provide a stable ABI except via the command line, so I don't want to give people the false impression that they can use our code as a semantically versioned stable module, since they can't. It might be better to just update the documentation to use git clone rather than go get so we can avoid the entire problem.

  4. chrisd8088 commented on Aug 11, 2021

    @chrisd8088
    Member

    As for the documentation, I'd agree it probably only makes sense to suggest using git clone. (Hence my caveated "partially resolves" comment in #4575.)

    The Go module version question arose because while I also don't get an error with go get github.com/git-lfs/git-lfs per se, it clearly isn't retrieving anything like the latest version, and there are some oddities as a consequence like the very old version of the Git LFS project page that's returned by https://pkg.go.dev/github.com/git-lfs/git-lfs.

  5. bk2204 commented on Aug 11, 2021

    @bk2204
    Member

    Ah, I'm probably seeing the latest version because I have GOPROXY=direct, which makes things work normally for me without using the proxy. So in that case, yes, I think we should probably do both.

  6. chrisd8088 commented on Aug 12, 2021

    @chrisd8088
    Member

    I've updated the wiki to only mention the use of git clone.

    I think the remaining outstanding item is to add something to our docs, if it's not there already, advising that our ABI is not stable or intended for reuse outside of the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions