Skip to content

Commit 022d0ee

Browse files
committed
Add GOWORK env variable when go vet is run
The cinder-operator patch [1] introduces the 'go.work' file within the repository with the goal of automating the way we deal with multi module dependencies. However, the side effect of having a versioned 'go.work' in the repo is the failure of this script because GOWORK is automatically set to "on". This patch fixes the CI run on the cinder-operator PR [1], introducing a GOWORK variable (which is set to off by default) to make sure we can successfully run this check regardless of the Makefile approach. [1] openstack-k8s-operators/cinder-operator#79 Signed-off-by: Francesco Pantano <[email protected]>
1 parent 9471567 commit 022d0ee

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

test-runner/gofmt.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
set -ex
33

4+
GOWORK=${GOWORK:-'off'}
45
BASE_DIR="$(dirname $0)"
56
cd "${BASE_DIR}/../.."
67

@@ -10,5 +11,5 @@ if [ -n "$1" ]; then
1011
fi
1112

1213
pushd ${MODULE_DIR}
13-
go fmt ./...
14+
GOWORK=$GOWORK go fmt ./...
1415
popd

test-runner/golangci.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
set -ex
33

4+
GOWORK=${GOWORK:-'off'}
45
BASE_DIR="$(dirname $0)"
56
cd "${BASE_DIR}/../.."
67

@@ -21,5 +22,5 @@ fi
2122

2223
pushd ${MODULE_DIR}
2324

24-
GOGC=10 GOLANGCI_LINT_CACHE=/tmp/golangci-cache ${BASE_DIR}/../../bin/golangci-lint run --timeout=${TIMEOUT}m -v
25+
GOWORK=$GOWORK GOGC=10 GOLANGCI_LINT_CACHE=/tmp/golangci-cache ${BASE_DIR}/../../bin/golangci-lint run --timeout=${TIMEOUT}m -v
2526
popd

test-runner/golint.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -ex
55
# "-set_exit_status" otherwise
66
LINT_EXIT_STATUS="-set_exit_status"
77

8+
GOWORK=${GOWORK:-'off'}
89
BASE_DIR="$(dirname $0)"
910
cd "${BASE_DIR}/../.."
1011

@@ -25,5 +26,5 @@ fi
2526
pushd ${MODULE_DIR}
2627
export GOFLAGS="-mod=mod"
2728

28-
golint ${LINT_EXIT_STATUS} ./...
29+
GOWORK=$GOWORK golint ${LINT_EXIT_STATUS} ./...
2930
popd

test-runner/gotest.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
set -ex
33

4+
GOWORK=${GOWORK:-'off'}
45
BASE_DIR="$(dirname $0)"
56
cd "${BASE_DIR}/../.."
67

@@ -10,5 +11,5 @@ if [ -n "$1" ]; then
1011
fi
1112

1213
pushd ${MODULE_DIR}
13-
go test -mod=mod -v ./...
14+
GOWORK=$GOWORK go test -mod=mod -v ./...
1415
popd

test-runner/govet.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
set -ex
33

4+
GOWORK=${GOWORK:-'off'}
45
BASE_DIR="$(dirname $0)"
56
cd "${BASE_DIR}/../.."
67

@@ -10,5 +11,5 @@ if [ -n "$1" ]; then
1011
fi
1112

1213
pushd ${MODULE_DIR}
13-
go vet -mod=mod ./...
14+
GOWORK=$GOWORK go vet -mod=mod ./...
1415
popd

0 commit comments

Comments
 (0)