From 0295ae731bbec8b34d14a87605ad66da716010c4 Mon Sep 17 00:00:00 2001 From: shirou Date: Sat, 17 Feb 2024 11:37:48 +0000 Subject: [PATCH] fix mktypes.sh --- .github/workflows/test.yml | 2 +- mktypes.sh | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1eca993ff..70bd92de1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: run: | versions=$(curl -s 'https://go.dev/dl/?mode=json' | jq -c 'map(.version[2:])') echo "::set-output name=value::${versions}" - test_v3_module: + test: needs: go-versions strategy: fail-fast: false diff --git a/mktypes.sh b/mktypes.sh index 264ba1939..3e471f318 100644 --- a/mktypes.sh +++ b/mktypes.sh @@ -1,20 +1,16 @@ #!/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) GOARCH=$(go env GOARCH) GOARCH=$(go env GOARCH) -for DIR in . +for PKG in $PKGS do - (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) + 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