shirou_gopsutil/mktypes.sh

17 lines
407 B
Bash
Raw Normal View History

#!/bin/sh
2014-12-30 23:13:52 +08:00
PKGS="cpu disk docker host load mem net process"
2014-12-30 23:13:52 +08:00
GOOS=$(go env GOOS)
GOARCH=$(go env GOARCH)
GOARCH=$(go env GOARCH)
2014-12-30 23:13:52 +08:00
for PKG in $PKGS
2014-12-30 23:13:52 +08:00
do
if [ -e "${PKG}/types_${GOOS}.go" ]; then
(echo "// +build $GOOS"
echo "// +build $GOARCH"
go tool cgo -godefs "${PKG}/types_${GOOS}.go") | gofmt > "${PKG}/${PKG}_${GOOS}_${GOARCH}.go"
fi
2014-12-30 23:13:52 +08:00
done