-
-
Notifications
You must be signed in to change notification settings - Fork 407
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·83 lines (67 loc) · 1.53 KB
/
build.sh
File metadata and controls
executable file
·83 lines (67 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh -e
build() {
ROOT="$GOPATH/src/honnef.co/go/tools"
os="$1"
arch="$2"
echo "Building GOOS=$os GOARCH=$arch..."
exe="staticcheck"
if [ $os = "windows" ]; then
exe="${exe}.exe"
fi
target="staticcheck_${os}_${arch}"
arm=""
case "$arch" in
armv5l)
arm=5
arch=arm
;;
armv6l)
arm=6
arch=arm
;;
armv7l)
arm=7
arch=arm
;;
arm64)
arch=arm64
;;
esac
mkdir "$d/staticcheck"
cp "$ROOT/LICENSE" "$ROOT/LICENSE-THIRD-PARTY" "$d/staticcheck"
CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm GO111MODULE=on go build -trimpath -o "$d/staticcheck/$exe" honnef.co/go/tools/cmd/staticcheck
(
cd "$d"
tar -czf "$target.tar.gz" staticcheck
sha256sum "$target.tar.gz" > "$target.tar.gz.sha256"
)
rm -rf "$d/staticcheck"
}
rev="$1"
if [ -z "$rev" ]; then
echo "Usage: $0 <version>"
exit 1
fi
mkdir "$rev"
d=$(realpath "$rev")
wrk=$(mktemp -d)
trap "{ rm -rf \"$wrk\"; }" EXIT
cd "$wrk"
go mod init foo
GO111MODULE=on go get -d honnef.co/go/tools/cmd/staticcheck@"$rev"
SYSTEMS=(windows linux freebsd)
ARCHS=(amd64 386)
for os in ${SYSTEMS[@]}; do
for arch in ${ARCHS[@]}; do
build "$os" "$arch"
done
done
build "darwin" "amd64"
build "darwin" "arm64"
for arch in armv5l armv6l armv7l arm64; do
build "linux" "$arch"
done
(
cd "$d"
sha256sum -c --strict *.sha256
)