git2go/README.md

2.4 KiB

GO libgit2

GoDoc Build Status

Go bindings for libgit2.

Updated 2024/12/16

Which Go version to use

  • This package is updated to work against libgit2 version 1.8 on Debian sid
  • There is one line commented out which needs to be fixed in remote.go
  • some of the tests seem to run
go install go.wit.com/apps/go-clone@latest
go install go.wit.com/apps/go-mod-clean@latest
go-clone --recusive go.wit.com/lib/libgit2

Which branch to send Pull requests to

TODO: not sure yet

Installing

This project wraps the functionality provided by libgit2. It thus needs it in order to perform the work.

This project wraps the functionality provided by libgit2. If you're using a versioned branch, install it to your system via your system's package manager and then install libgit2.

Versioned branch, dynamic linking

When linking dynamically against a released version of libgit2, install it via your system's package manager. CGo will take care of finding its pkg-config file and set up the linking. Import via Go modules, e.g. to work against libgit2 v1.2

    goimports -w *.go

Parallelism and network operations

libgit2 may use OpenSSL and LibSSH2 for performing encrypted network connections. For now, libgit2 asks libgit2 to set locking for OpenSSL. This makes HTTPS connections thread-safe, but it is fragile and will likely stop doing it soon. This may also make SSH connections thread-safe if your copy of libssh2 is linked against OpenSSL. Check libgit2's THREADSAFE.md for more information.

Running the tests

For the stable version, go test will work as usual. For the main branch, similarly to installing, running the tests requires building a local libgit2 library, so the Makefile provides a wrapper that makes sure it's built

make test-static

Alternatively, you can build the library manually first and then run the tests

make install-static
go test -v -tags static ./...

License

M to the I to the T. See the LICENSE file if you've never seen an MIT license before.

Authors

  • Carlos Martín (github@carlosmn)
  • Vicent Martí (github@vmg)