Golang dependencies and glide

Rainer Müller raimue at macports.org
Sat Sep 8 12:46:05 UTC 2018


On 2018-09-04 11:54, Mojca Miklavec wrote:
> Our current support for go-based software and libraries is pretty much
> non-existant. The fact that everything needs to be done manually is
> super suboptimal. Ideally we would have a PortGroup which could take
> care of dependencies in a similar way as this is done for python or
> perl port, so that supporting go packages would be easy to do, but
> this requires a volunteer with sufficient knowledge (or willingness to
> learn) of go packaging as well as some basic tcl. (Ruby is an example
> of partially implemented support and semi-abandoned packages. Perl and
> Python are supported and maintained relatively well, even though there
> is still a lot of room for improvement.)

Go links everything statically and the dependencies are just snapshots
of other git repositories. It is not possible to create ports for the
dependencies, as it might need exactly one tag or arbitrary commit of
the dependency. The glide.lock file can be used to determine the exact
revision/branch of the dependencies and generate a list of tarballs.
These would when be fetched and put into a temporary GOPATH/GOROOT (or
whatever it is called) to be used during build.

The peco port is already using this approach and I think it is the right
way to go foward. The snippets from that port should be turned into a
port group.

As an example, look at the cargo and cargo_fetch port groups that
implement dependencies for rust this way:

https://github.com/macports/macports-ports/blob/d617406c591d7247155ea6b01602916dfbbb77ed/_resources/port1.0/group/cargo_fetch-1.0.tcl

Rainer


More information about the macports-dev mailing list