chore: Rework check-deps script for other os+arch combos (#16742)

This commit is contained in:
Maya Strandboge 2025-04-09 13:51:35 -05:00 committed by GitHub
parent 316d6a0911
commit 2517ad5ae0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 36 additions and 16 deletions

View File

@ -9,7 +9,6 @@ following works:
- collectd.org [ISC License](https://github.com/collectd/go-collectd/blob/master/LICENSE) - collectd.org [ISC License](https://github.com/collectd/go-collectd/blob/master/LICENSE)
- dario.cat/mergo [BSD 3-Clause "New" or "Revised" License](https://github.com/imdario/mergo/blob/master/LICENSE) - dario.cat/mergo [BSD 3-Clause "New" or "Revised" License](https://github.com/imdario/mergo/blob/master/LICENSE)
- filippo.io/edwards25519 [BSD 3-Clause "New" or "Revised" License](https://github.com/FiloSottile/edwards25519/blob/main/LICENSE) - filippo.io/edwards25519 [BSD 3-Clause "New" or "Revised" License](https://github.com/FiloSottile/edwards25519/blob/main/LICENSE)
- github.com/99designs/go-keychain [MIT License](https://github.com/99designs/go-keychain/blob/master/LICENSE)
- github.com/99designs/keyring [MIT License](https://github.com/99designs/keyring/blob/master/LICENSE) - github.com/99designs/keyring [MIT License](https://github.com/99designs/keyring/blob/master/LICENSE)
- github.com/Azure/azure-amqp-common-go [MIT License](https://github.com/Azure/azure-amqp-common-go/blob/master/LICENSE) - github.com/Azure/azure-amqp-common-go [MIT License](https://github.com/Azure/azure-amqp-common-go/blob/master/LICENSE)
- github.com/Azure/azure-event-hubs-go [MIT License](https://github.com/Azure/azure-event-hubs-go/blob/master/LICENSE) - github.com/Azure/azure-event-hubs-go [MIT License](https://github.com/Azure/azure-event-hubs-go/blob/master/LICENSE)
@ -149,7 +148,6 @@ following works:
- github.com/gabriel-vasile/mimetype [MIT License](https://github.com/gabriel-vasile/mimetype/blob/master/LICENSE) - github.com/gabriel-vasile/mimetype [MIT License](https://github.com/gabriel-vasile/mimetype/blob/master/LICENSE)
- github.com/go-asn1-ber/asn1-ber [MIT License](https://github.com/go-asn1-ber/asn1-ber/blob/v1.3/LICENSE) - github.com/go-asn1-ber/asn1-ber [MIT License](https://github.com/go-asn1-ber/asn1-ber/blob/v1.3/LICENSE)
- github.com/go-chi/chi [MIT License](https://github.com/go-chi/chi/blob/master/LICENSE) - github.com/go-chi/chi [MIT License](https://github.com/go-chi/chi/blob/master/LICENSE)
- github.com/go-darwin/apfs [BSD 3-Clause "New" or "Revised" License](https://github.com/go-darwin/apfs/blob/main/LICENSE)
- github.com/go-faster/city [MIT License](https://github.com/go-faster/city/blob/main/LICENSE) - github.com/go-faster/city [MIT License](https://github.com/go-faster/city/blob/main/LICENSE)
- github.com/go-faster/errors [BSD 3-Clause "New" or "Revised" License](https://github.com/go-faster/errors/blob/main/LICENSE) - github.com/go-faster/errors [BSD 3-Clause "New" or "Revised" License](https://github.com/go-faster/errors/blob/main/LICENSE)
- github.com/go-git/go-billy [Apache License 2.0](https://github.com/go-git/go-billy/blob/master/LICENSE) - github.com/go-git/go-billy [Apache License 2.0](https://github.com/go-git/go-billy/blob/master/LICENSE)

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
tmpdir="$(mktemp -d)" tmpdir="$(mktemp -d)"
@ -7,21 +7,43 @@ cleanup() {
} }
trap cleanup EXIT trap cleanup EXIT
targets="$(go tool dist list)" declare -a targets=(
"darwin/amd64"
"darwin/arm64"
"freebsd/amd64"
"freebsd/arm/7"
"freebsd/386"
"linux/amd64"
"linux/arm64/7"
"linux/arm/5"
"linux/arm/6"
"linux/386"
"linux/mips"
"linux/mipsle"
"linux/ppc64le"
"linux/riscv64"
"linux/s390x"
"windows/amd64"
"windows/arm64"
"windows/386"
)
for target in ${targets}; do for target in "${targets[@]}"; do
# only check platforms we build for os="${target%%/*}"
case "${target}" in rest="${target#*/}"
linux/*) ;;
windows/*) ;;
freebsd/*) ;;
darwin/*) ;;
*) continue;;
esac
echo "${target%%/*}/${target##*/}" if [[ "$rest" == */* ]]; then
GOOS=${target%%/*} GOARCH=${target##*/} \ arch="${rest%%/*}"
go list -deps -f '{{with .Module}}{{.Path}}{{end}}' ./cmd/telegraf/ >> "${tmpdir}/golist" arm="${rest#*/}"
echo "GOOS=${os} GOARCH=${arch} GOARM=${arm}"
CGO_ENABLED=0 GOOS=${os} GOARCH=${arch} GOARM=${arm} \
go list -f '{{with .Module}}{{.Path}}{{end}}' -deps ./cmd/telegraf >> "${tmpdir}/golist"
else
echo "GOOS=${os} GOARCH=${rest}"
CGO_ENABLED=0 GOOS=${os} GOARCH=${rest} \
go list -f '{{with .Module}}{{.Path}}{{end}}' -deps ./cmd/telegraf >> "${tmpdir}/golist"
fi
done done
LC_ALL=C sort -u < "${tmpdir}/golist" | while IFS= read -r dep; do LC_ALL=C sort -u < "${tmpdir}/golist" | while IFS= read -r dep; do