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-11-12 05:58:39 +08:00
|
|
|
for DIR in . v3
|
2014-12-30 23:13:52 +08:00
|
|
|
do
|
2020-11-12 05:58:39 +08:00
|
|
|
(cd "$DIR" || exit
|
|
|
|
for PKG in $PKGS
|
|
|
|
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
|
|
|
|
done)
|
2014-12-30 23:13:52 +08:00
|
|
|
done
|