splitsh / lite

Split a repository to read-only standalone repositories
MIT License
1.55k stars 69 forks source link

error: cannot find package "github.com/libgit2/git2go/v34" #73

Closed bshaffer closed 11 months ago

bshaffer commented 11 months ago

I am getting the following error when compiling splitsh on github. here is my script:

+ go get github.com/splitsh/lite
cannot find package "github.com/libgit2/git2go/v34" in any of:
    /opt/hostedtoolcache/go/1.20.11/x64/src/github.com/libgit2/git2go/v34 (from $GOROOT)
    /home/runner/work/google-cloud-php/google-cloud-php/.split/go/src/github.com/libgit2/git2go/v34 (from $GOPATH)
mkdir $1
export GOPATH=$1/go

go env -w GO111MODULE=off
go get -d github.com/libgit2/git2go
cd $GOPATH/src/github.com/libgit2/git2go
git checkout next
git submodule update --init
make install

go get github.com/splitsh/lite
go build -o $1/splitsh-lite github.com/splitsh/lite

My github action is using ubuntu-latest. I think the issue has to do with the new tag for v2.0.0. I am actively debugging it, and plan to either follow the guide in https://github.com/splitsh/lite/issues/64 or try to roll it back.

I just wanted to submit this issue here also, in case it's helpful to someone else!

fabpot commented 11 months ago

You need to follow the instructions from https://github.com/splitsh/lite#manual-installation

bshaffer commented 11 months ago

Thank you, Fabien. I tried for literal hours following the README and I still can't get it to work. Is there any way you could provide slightly more guidance?

One of the issues is that I've turned modules off via go env -w GO111MODULE=off, so git mod tidy throws an error.

bshaffer commented 11 months ago

I was able to fix this by compiling libgit2 from source so that I could install 1.5 (rather than 1.1, which is the version installed by default via apt on Ubuntu 22.06, which is the latest version supported by Github Actions).

In case it's helpful to anyone else, this is what worked for me:

jobs:
  splitsh:
    name: SplitSH
    runs-on: ubuntu-latest
    env:
      LD_LIBRARY_PATH: /usr/local/lib
    steps:
    - name: Clone libgit2
      uses: actions/checkout@master
      with:
        repository: libgit2/libgit2
        ref: v1.5.1
        path: libgit2
    - name: Install libgit2
      run: |
        mkdir libgit2/build && cd libgit2/build
        cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
        sudo cmake --build . --target install
    - name: Compile splitsh
      run: |
        go env -w GO111MODULE=off
        go get github.com/splitsh/lite
        go build -o /usr/local/bin/splitsh-lite github.com/splitsh/lite

This places the splitsh-lite binary in /usr/local/bin, and everything worked as expected from there.