summaryrefslogtreecommitdiffhomepage
path: root/generate-vendor.sh
blob: 51d0fff4872ce950caa97e87b3a39ea47789c645 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

echo "# This was generated by ./generate-vendor.sh" > Gopkg.lock
echo "# This was generated by ./generate-vendor.sh" > Gopkg.toml

while read -r package; do
	cat >> Gopkg.lock <<-_EOF
	[[projects]]
	  branch = "master"
	  name = "$package"
	  revision = "$(< "$GOPATH/src/$package/.git/refs/heads/master")"

	_EOF
	cat >> Gopkg.toml <<-_EOF
	[[constraint]]
	  branch = "master"
	  name = "$package"

	_EOF
done < <(sed -n 's/.*"\(golang.org\/x\/[^/]\+\)\/\?.*".*/\1/p' *.go */*.go | sort | uniq)