mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 03:18:59 +00:00
Easy godep/go vet setup.
This commit is contained in:
parent
abbb40abd2
commit
a105ad1391
33
build.sh
33
build.sh
@ -10,25 +10,28 @@ host=$(hostname)
|
|||||||
host=${host%%.*}
|
host=${host%%.*}
|
||||||
ldflags="-w -X main.Version $version -X main.BuildStamp $date -X main.BuildUser $user -X main.BuildHost $host"
|
ldflags="-w -X main.Version $version -X main.BuildStamp $date -X main.BuildUser $user -X main.BuildHost $host"
|
||||||
|
|
||||||
|
check() {
|
||||||
|
if ! command -v godep >/dev/null ; then
|
||||||
|
echo "Error: no godep. Try \"$0 setup\"."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
check
|
||||||
|
|
||||||
go vet ./... || exit 1
|
go vet ./... || exit 1
|
||||||
|
|
||||||
if command -v godep >/dev/null ; then
|
godep go build $* -ldflags "$ldflags" ./cmd/syncthing
|
||||||
godep=godep
|
|
||||||
else
|
|
||||||
echo "Warning: no godep, using \"go get\" instead."
|
|
||||||
echo "Try \"go get github.com/tools/godep\"."
|
|
||||||
go get -d ./cmd/syncthing
|
|
||||||
godep=
|
|
||||||
fi
|
|
||||||
${godep} go build $* -ldflags "$ldflags" ./cmd/syncthing
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assets() {
|
assets() {
|
||||||
|
check
|
||||||
godep go run cmd/assets/assets.go gui > auto/gui.files.go
|
godep go run cmd/assets/assets.go gui > auto/gui.files.go
|
||||||
}
|
}
|
||||||
|
|
||||||
test() {
|
test() {
|
||||||
|
check
|
||||||
godep go test -cpu=1,2,4 ./...
|
godep go test -cpu=1,2,4 ./...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,9 +66,17 @@ zipDist() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deps() {
|
deps() {
|
||||||
|
check
|
||||||
godep save ./cmd/syncthing ./cmd/assets ./discover/cmd/discosrv
|
godep save ./cmd/syncthing ./cmd/assets ./discover/cmd/discosrv
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
echo Installing godep...
|
||||||
|
go get -u github.com/tools/godep
|
||||||
|
echo Installing go vet...
|
||||||
|
go get -u code.google.com/p/go.tools/cmd/vet
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"")
|
"")
|
||||||
shift
|
shift
|
||||||
@ -149,6 +160,10 @@ case "$1" in
|
|||||||
assets
|
assets
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
setup)
|
||||||
|
setup
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Unknown build parameter $1"
|
echo "Unknown build parameter $1"
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user