Skip to content

Set go version to 1.14, to enable vendor builds by default. #2749

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/cortexproject/cortex

go 1.13
go 1.14

require (
cloud.google.com/go/bigtable v1.2.0
Expand Down
3 changes: 3 additions & 0 deletions tools/test
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ run_test() {
local dir=$1
if [ -z "$NO_GO_GET" ]; then
go get -t -tags "${TAGS[@]}" "$dir"
go mod vendor # re-vendor everything
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why we need to run go mod vendor in this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason is to avoid error when go get fetches additional depedendency, but doesn’t put it into vendor. In go 1.14, if you have vendor directory, it is used by default, but vendor/modules.txt is verified against go.mod. Without calling go mod vendor here, that verification fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if our test didn’t do additional go get, but I’m not sure why it’s here, so left it for now.
In case of cover tool later in the file, I think that should be part of the build image instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we remove the -go-get and -no-go-get support at all, always enforcing the behaviour of NO_GO_GET=true (current default)? -go-get is not used by any script we have, so the only way to use it is to manually call tools/test -go-get.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we remove the -go-get and -no-go-get support at all, always enforcing the behaviour of NO_GO_GET=true (current default)? -go-get is not used by any script we have, so the only way to use it is to manually call tools/test -go-get.

I will remove it. This doesn't fix problem with cover tool, used when run under CIRCLECI.

fi

local GO_TEST_ARGS_RUN=("${GO_TEST_ARGS[@]}")
Expand Down Expand Up @@ -147,6 +148,8 @@ fi

if [ -n "$SLOW" ] && [ -z "$COVERDIR" ]; then
go get github.com/weaveworks/tools/cover
go mod vendor # re-vendor everything
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about putting the cover tool into the build image, like we do with various other tools?

RUN GO111MODULE=on go get -tags netgo \
github.com/client9/misspell/cmd/[email protected] \
github.com/golang/protobuf/[email protected] \
github.com/gogo/protobuf/[email protected] \
github.com/gogo/protobuf/[email protected] && \

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will send PR to include cover tool in build image.


cover "$coverdir"/* >profile.cov
rm -rf "$coverdir"
go tool cover -html=profile.cov -o=coverage.html
Expand Down
Loading