1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-24 13:48:56 +08:00
shirou_gopsutil/mktypes.sh
2024-05-28 22:27:17 +09:00

16 lines
403 B
Bash

#!/bin/sh
PKGS="cpu disk docker host load mem net process sensors winservices"
GOOS=$(go env GOOS)
GOARCH=$(go env GOARCH)
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