govcs is a simple abstraction layer around version control tools. It currently supports Git and Mercurial. With it you can get information about the repository including remotes, branches, commits, etc.
GPLv3
go get hg.sr.ht/~grim/govcs
This simple example will output the default remote for the repository in the
my-src-dir
directory.
package main
import(
"fmt"
"hg.sr.ht/~grim/govcs"
)
func main() {
vcs, err := govcs.Dectect("my-src-dir")
if err != nil {
panic(err)
}
fmt.Printf("remote: %s\n", vcs.Remote(""))
}