pkg-go-tools: Files

Command pgt-gopath

Program pgt-gopath constructs a Go workspace src directory from the Debian unstable archive. See

This is useful, for example, for quick continuous integration: gone is the computationally intensive step of identifying reverse dependencies of Debian packages, and gone is the overhead of installing .deb packages (orders of magnitude slower than pgt-gopath). One can directly use the go tool, which builds/tests quickly and with caching. See for more details on how Debian uses this.

Even users outside of Debian can use such a Go workspace to obtain a reasonably large body of software with real-world usage, perhaps to run regression tests when doing changes to the Go standard library.

pgt-gopath leverages apt-cacher-ng(8) for caching: each run of pgt-gopath constructs an entirely new GOPATH/src directory, consuming many .orig tarballs from the Debian archive. This typically takes less than 10 seconds on a modern computer.

The resulting src directory is suffixed with the UNIX timestamp of the release metadata’s last modified timestamp. In case the last modified timestamp matches the current on-disk timestamp, pgt-gopath immediately exits successfully. Hence, it can be run in a minutely cronjob.

This last modified timestamp is printed to stdout (whereas log messages are printed to stderr). This allows for post-processing (e.g. chmod) and atomically updating the Go workspace via:

# Not safe for concurrent execution: wrap in flock(1) or a systemd service.
set -e

# Update pgt-gopath to pick up fixes:
go get -u

mkdir -p /srv/gopath
cd /srv/gopath

# Create a new src-<timestamp> directory:

# Atomically update the src symlink:
ln -snf src-${latest} new_src
mv -T new_src src

# Clean up all old src-<timestamp> directories:
rm -rf -- $(ls -d src-* | grep -v "^src-$latest\$")

Package Files

debhelper.go gopath.go patches.go sources.go unpack.go

Package main imports 19 packages (graph). Updated 2018-03-10. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).