2020-09-06 21:16:13 +08:00
|
|
|
#!/bin/sh
|
2014-12-30 23:13:52 +08:00
|
|
|
|
2020-09-06 21:16:13 +08:00
|
|
|
PKGS="cpu disk docker host load mem net process"
|
2014-12-30 23:13:52 +08:00
|
|
|
|
2020-09-06 21:16:13 +08:00
|
|
|
GOOS=$(go env GOOS)
|
|
|
|
GOARCH=$(go env GOARCH)
|
|
|
|
GOARCH=$(go env GOARCH)
|
2014-12-30 23:13:52 +08:00
|
|
|
|
2020-09-06 21:16:13 +08:00
|
|
|
for PKG in $PKGS
|
2014-12-30 23:13:52 +08:00
|
|
|
do
|
2020-09-06 21:16:13 +08:00
|
|
|
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
|