Skip to content

Commit f3f16a2

Browse files
authored
Merge pull request #2151 from vincepri/fix-golanci-ensure
🐛 Update golanci-lint script
2 parents 595f569 + 92b892f commit f3f16a2

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

hack/ensure-golangci-lint.sh

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ get_binaries() {
103103
linux/mips64le) BINARIES="golangci-lint" ;;
104104
linux/ppc64le) BINARIES="golangci-lint" ;;
105105
linux/s390x) BINARIES="golangci-lint" ;;
106+
linux/riscv64) BINARIES="golangci-lint" ;;
107+
netbsd/386) BINARIES="golangci-lint" ;;
108+
netbsd/amd64) BINARIES="golangci-lint" ;;
109+
netbsd/armv6) BINARIES="golangci-lint" ;;
110+
netbsd/armv7) BINARIES="golangci-lint" ;;
106111
windows/386) BINARIES="golangci-lint" ;;
107112
windows/amd64) BINARIES="golangci-lint" ;;
108113
windows/arm64) BINARIES="golangci-lint" ;;
@@ -209,9 +214,10 @@ log_crit() {
209214
uname_os() {
210215
os=$(uname -s | tr '[:upper:]' '[:lower:]')
211216
case "$os" in
212-
cygwin_nt*) os="windows" ;;
217+
msys*) os="windows" ;;
213218
mingw*) os="windows" ;;
214-
msys_nt*) os="windows" ;;
219+
cygwin*) os="windows" ;;
220+
win*) os="windows" ;;
215221
esac
216222
echo "$os"
217223
}
@@ -244,7 +250,7 @@ uname_os_check() {
244250
solaris) return 0 ;;
245251
windows) return 0 ;;
246252
esac
247-
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"
253+
log_crit "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value."
248254
return 1
249255
}
250256
uname_arch_check() {
@@ -263,9 +269,10 @@ uname_arch_check() {
263269
mips64) return 0 ;;
264270
mips64le) return 0 ;;
265271
s390x) return 0 ;;
272+
riscv64) return 0 ;;
266273
amd64p32) return 0 ;;
267274
esac
268-
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"
275+
log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value."
269276
return 1
270277
}
271278
untar() {
@@ -327,11 +334,14 @@ http_copy() {
327334
github_release() {
328335
owner_repo=$1
329336
version=$2
330-
test -z "$version" && version="latest"
331-
giturl="https://github.com/${owner_repo}/releases/${version}"
337+
if [ -z "$version" ]; then
338+
giturl="https://api.github.com/repos/${owner_repo}/releases/latest"
339+
else
340+
giturl="https://api.github.com/repos/${owner_repo}/releases/tags/${version}"
341+
fi
332342
json=$(http_copy "$giturl" "Accept:application/json")
333343
test -z "$json" && return 1
334-
version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name":"//' | sed 's/".*//')
344+
version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name": "//' | sed 's/".*//')
335345
test -z "$version" && return 1
336346
echo "$version"
337347
}

0 commit comments

Comments
 (0)