@@ -486,53 +486,53 @@ def testGo(prefix, packagesToTest) {
486486 println " Building citogo"
487487 sh ' (cd citogo && go install)'
488488
489- println " Installing golangci-lint"
490- dir(" .." ) {
491- retry(5 ) {
492- // This works with go1.12.12 but not go1.13.1 with an error containing "invalid pseudo-version"
493- sh ' GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.16.0'
489+ if (prefix == " test_linux_go_" ) {
490+ // Only test golangci-lint on linux
491+ println " Installing golangci-lint"
492+ dir(" .." ) {
493+ retry(5 ) {
494+ sh ' GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.23.6'
495+ }
494496 }
495- }
496497
497498
498- def hasKBFSChanges = packagesToTest. keySet(). findIndexOf { key -> key =~ / ^github.com\/ keybase\/ client\/ go\/ kbfs/ } >= 0
499- if (hasKBFSChanges) {
500- println " Running golangci-lint on KBFS"
501- dir(' kbfs' ) {
502- retry(5 ) {
503- timeout(activity : true , time : 180 , unit : ' SECONDS' ) {
504- // Ignore the `dokan` directory since it contains lots of c code.
505- // Ignore the `protocol` directory, autogeneration has some critques
506- sh ' go list -f "{{.Dir}}" ./... | fgrep -v dokan | xargs realpath --relative-to=. | xargs golangci-lint run'
499+ def hasKBFSChanges = packagesToTest. keySet(). findIndexOf { key -> key =~ / ^github.com\/ keybase\/ client\/ go\/ kbfs/ } >= 0
500+ if (hasKBFSChanges) {
501+ println " Running golangci-lint on KBFS"
502+ dir(' kbfs' ) {
503+ retry(5 ) {
504+ timeout(activity : true , time : 180 , unit : ' SECONDS' ) {
505+ // Ignore the `dokan` directory since it contains lots of c code.
506+ // Ignore the `protocol` directory, autogeneration has some critques
507+ sh ' go list -f "{{.Dir}}" ./... | fgrep -v dokan | xargs realpath --relative-to=. | xargs golangci-lint run'
508+ }
507509 }
508510 }
509511 }
510- }
511512
512- if (env. CHANGE_TARGET ) {
513- println (" Running golangci-lint on new code" )
514- fetchChangeTarget()
515- def BASE_COMMIT_HASH = getBaseCommitHash()
516- timeout(activity : true , time : 360 , unit : ' SECONDS' ) {
517- sh " go list -f '{{.Dir}}' ./... | fgrep -v kbfs | fgrep -v protocol | xargs realpath --relative-to=. | xargs golangci-lint run --new-from-rev ${ BASE_COMMIT_HASH} --deadline 5m0s"
518- }
513+ if (env. CHANGE_TARGET ) {
514+ println (" Running golangci-lint on new code" )
515+ fetchChangeTarget()
516+ def BASE_COMMIT_HASH = getBaseCommitHash()
517+ timeout(activity : true , time : 360 , unit : ' SECONDS' ) {
518+ sh " go list -f '{{.Dir}}' ./... | fgrep -v kbfs | fgrep -v protocol | xargs realpath --relative-to=. | xargs golangci-lint run --new-from-rev ${ BASE_COMMIT_HASH} --deadline 5m0s"
519+ }
519520
520- println (" Running golangci-lint for dead code" )
521- timeout(activity : true , time : 360 , unit : ' SECONDS' ) {
522- def diffFileList = getDiffFileList()
523- def diffPackageList = sh(returnStdout : true , script : " bash -c \" set -o pipefail; echo '${ diffFileList} ' | { grep '^go\\ /' || true; } | { grep -v 'go/revision' || true; } | { grep -v 'go/vendor' || true; } | { grep -v 'go/Makefile' || true; } | sed 's/^go\\ ///' | sed 's/^\\ (.*\\ )\\ /[^\\ /]*\$ /\\ 1/' | sort | uniq\" " ). trim(). split()
524- diffPackageList. each { pkg ->
525- dir(pkg) {
526- // Ignore the exit code 5, which indicates that there were
527- // no files to analyze -- that's expected if the files were
528- // all tagged for a different platform.
529- sh ' golangci-lint run --no-config --disable-all --enable=deadcode --deadline 5m0s || test $? -eq 5'
521+ println (" Running golangci-lint for dead code" )
522+ timeout(activity : true , time : 360 , unit : ' SECONDS' ) {
523+ def diffFileList = getDiffFileList()
524+ def diffPackageList = sh(returnStdout : true , script : " bash -c \" set -o pipefail; echo '${ diffFileList} ' | { grep '^go\\ /' || true; } | { grep -v 'go/revision' || true; } | { grep -v 'go/vendor' || true; } | { grep -v 'go/Makefile' || true; } | sed 's/^go\\ ///' | sed 's/^\\ (.*\\ )\\ /[^\\ /]*\$ /\\ 1/' | sort | uniq\" " ). trim(). split()
525+ diffPackageList. each { pkg ->
526+ dir(pkg) {
527+ // Ignore the exit code 5, which indicates that there were
528+ // no files to analyze -- that's expected if the files were
529+ // all tagged for a different platform.
530+ sh ' golangci-lint run --no-config --disable-all --enable=deadcode --deadline 5m0s || test $? -eq 5'
531+ }
530532 }
531533 }
532534 }
533- }
534535
535- if (prefix == " test_linux_go_" ) {
536536 // Windows `gofmt` pukes on CRLF.
537537 // Macos pukes on mockgen because ¯\_(ツ)_/¯.
538538 // So, only run on Linux.
0 commit comments