Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Update golanci-lint script #2151

Merged
merged 1 commit into from
Jan 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 17 additions & 7 deletions hack/ensure-golangci-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ get_binaries() {
linux/mips64le) BINARIES="golangci-lint" ;;
linux/ppc64le) BINARIES="golangci-lint" ;;
linux/s390x) BINARIES="golangci-lint" ;;
linux/riscv64) BINARIES="golangci-lint" ;;
netbsd/386) BINARIES="golangci-lint" ;;
netbsd/amd64) BINARIES="golangci-lint" ;;
netbsd/armv6) BINARIES="golangci-lint" ;;
netbsd/armv7) BINARIES="golangci-lint" ;;
windows/386) BINARIES="golangci-lint" ;;
windows/amd64) BINARIES="golangci-lint" ;;
windows/arm64) BINARIES="golangci-lint" ;;
Expand Down Expand Up @@ -209,9 +214,10 @@ log_crit() {
uname_os() {
os=$(uname -s | tr '[:upper:]' '[:lower:]')
case "$os" in
cygwin_nt*) os="windows" ;;
msys*) os="windows" ;;
mingw*) os="windows" ;;
msys_nt*) os="windows" ;;
cygwin*) os="windows" ;;
win*) os="windows" ;;
esac
echo "$os"
}
Expand Down Expand Up @@ -244,7 +250,7 @@ uname_os_check() {
solaris) return 0 ;;
windows) return 0 ;;
esac
log_crit "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value. Please file bug at https://github.com/client9/shlib"
log_crit "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value."
return 1
}
uname_arch_check() {
Expand All @@ -263,9 +269,10 @@ uname_arch_check() {
mips64) return 0 ;;
mips64le) return 0 ;;
s390x) return 0 ;;
riscv64) return 0 ;;
amd64p32) return 0 ;;
esac
log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value. Please file bug report at https://github.com/client9/shlib"
log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value."
return 1
}
untar() {
Expand Down Expand Up @@ -327,11 +334,14 @@ http_copy() {
github_release() {
owner_repo=$1
version=$2
test -z "$version" && version="latest"
giturl="https://github.com/${owner_repo}/releases/${version}"
if [ -z "$version" ]; then
giturl="https://api.github.com/repos/${owner_repo}/releases/latest"
else
giturl="https://api.github.com/repos/${owner_repo}/releases/tags/${version}"
fi
json=$(http_copy "$giturl" "Accept:application/json")
test -z "$json" && return 1
version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name":"//' | sed 's/".*//')
version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name": "//' | sed 's/".*//')
test -z "$version" && return 1
echo "$version"
}
Expand Down