fix mktypes.sh

pull/1628/head
shirou 1 year ago
parent ab0d977709
commit f9c39a6d8f

@ -13,7 +13,7 @@ jobs:
run: | run: |
versions=$(curl -s 'https://go.dev/dl/?mode=json' | jq -c 'map(.version[2:])') versions=$(curl -s 'https://go.dev/dl/?mode=json' | jq -c 'map(.version[2:])')
echo "::set-output name=value::${versions}" echo "::set-output name=value::${versions}"
test_v3_module: test:
needs: go-versions needs: go-versions
strategy: strategy:
fail-fast: false fail-fast: false

@ -1,19 +1,15 @@
#!/bin/sh #!/bin/sh
PKGS="cpu disk docker host load mem net process" PKGS="cpu disk docker host load mem net process sensors winservices"
GOOS=$(go env GOOS) GOOS=$(go env GOOS)
GOARCH=$(go env GOARCH) GOARCH=$(go env GOARCH)
for DIR in . for PKG in $PKGS
do do
(cd "$DIR" || exit if [ -e "${PKG}/types_${GOOS}.go" ]; then
for PKG in $PKGS (echo "// +build $GOOS"
do echo "// +build $GOARCH"
if [ -e "${PKG}/types_${GOOS}.go" ]; then go tool cgo -godefs "${PKG}/types_${GOOS}.go") | gofmt > "${PKG}/${PKG}_${GOOS}_${GOARCH}.go"
(echo "// +build $GOOS" fi
echo "// +build $GOARCH"
go tool cgo -godefs "${PKG}/types_${GOOS}.go") | gofmt > "${PKG}/${PKG}_${GOOS}_${GOARCH}.go"
fi
done)
done done

Loading…
Cancel
Save