Browse Source

Merge pull request #10454 from mkumatag/fix_shadow

Add shadow tool
Xiang Li 7 năm trước cách đây
mục cha
commit
0418488666
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      test

+ 5 - 1
test

@@ -448,7 +448,11 @@ function govet_shadow_pass {
 	fmtpkgs=$(for a in "${FMT[@]}"; do dirname "$a"; done | sort | uniq | grep -v "\\.")
 	# shellcheck disable=SC2206
 	fmtpkgs=($fmtpkgs)
-	vetRes=$(go tool vet -all -shadow "${fmtpkgs[@]}" 2>&1 | grep -v '/gw/' || true)
+	# Golang 1.12 onwards the experimental -shadow option is no longer available with go vet
+	go get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
+	export PATH=${GOPATH}/bin:${PATH}
+	shadow_tool=$(which shadow)
+	vetRes=$(go vet -all -vettool="${shadow_tool}" "${TEST[@]}")
 	if [ -n "${vetRes}" ]; then
 		echo -e "govet -all -shadow checking failed:\\n${vetRes}"
 		exit 255