Go 1.13 + go mod

6 views
Skip to first unread message

Patrick Ohly

unread,
Nov 4, 2019, 1:29:40 PM11/4/19
to kubernetes-sig...@googlegroups.com
Hello!

Just a heads up that the Kubernetes-CSI repos will switch to Go 1.13 for
building and testing in the CI. The change has already been made in
csi-release-tools (https://github.com/kubernetes-csi/csi-release-tools/pull/41).
I'll now prepare PRs for individual repos to include that change.

The last time we had a Go version dependency was around formatting of
code. Now it turned out that "go mod vendor" also produces slightly
different output between 1.12 and 1.13. To make it more obvious to
developers when their local Go may not be matching what the current
project is using, the PR above also adds a version check.

That check just triggers a warning. That's intentional, because for
example, 1.13 isn't required for building (yet - see below). A version
check as in Kubernetes ("make" fails when Go is too old) would not have
helped with the recent vendor mismatch either, because there the problem
was using Go 1.13 when preparing a PR when the CI then checked with
1.12. So beware of the warning and proceed at your own discretion -
YMMV and all that...

Another change is the new "update-vendor.sh" script which can be used to
update the vendor directory after making changes to go.mod.

Regarding Go 1.13: we now could use features that were added in that
release, for example the enhanced error handling
(https://blog.golang.org/go1.13-errors). This hasn't been discussed
yet. Personally I think that this is okay now. It'll affect projects
consuming shared packages (like csi-test or csi-lib-utils) but I can't
think of reasons why those shouldn't also switch to 1.13.

Go modules were already enabled earlier. As a result, it is no longer
necessary to check out in $GOPATH. Beware that Go 1.12 was not operating
in module mode when compiling in $GOPATH and then used the "vendor"
directory. When using Go 1.13 and/or building outside of $GOPATH, module
mode is active and the "vendor" directory is ignored unless you set
GOFLAGS=-mod=vendor.

The Prow and Travis CI do that via a Makefile variable
(https://github.com/kubernetes-csi/csi-release-tools/pull/42).

--
Best Regards

Patrick Ohly

Patrick Ohly

unread,
Nov 6, 2019, 9:12:35 AM11/6/19
to kubernetes-sig...@googlegroups.com
"Patrick Ohly" <patric...@intel.com> writes:
> A version
> check as in Kubernetes ("make" fails when Go is too old) would not have
> helped

I also fails in Kubernetes itself: the version check passes without
warning when using Go 1.13.1, but then the build fails with obscure
errors (https://github.com/kubernetes/kubernetes/issues/84224). Go 1.13
support is work in progress in
https://github.com/kubernetes/kubernetes/issues/82531.

IMHO that confirms that the non-fatal warning when major.minor don't
match is the right approach.
Reply all
Reply to author
Forward
0 new messages