Juju should be built with go 1.6

Nate Finch nate.finch at canonical.com
Mon Aug 22 17:11:17 UTC 2016


This shouldn't be news, but Juju must be built with go 1.6+ (we only
officially support go 1.6.0, but higher versions should work as well).

However, there was a bug in the 1.25 makefile, where it hadn't been updated
to install go 1.6, instead it was installing go 1.2.1 still.  Until now,
1.25 built just fine with go 1.2... but as of my next PR it will no longer
build with go 1.2 (due to values new to the go 1.6 stdlib that we now
depend on).

Juju 2.0 already had the update to the makefile, but I am today landing a
couple files that will hopefully make it more clear what's wrong if someone
tries to build with an earlier version of go.  In cmd/juju and cmd/jujud
there lives a version_canary.go file (one file for each directory, but
they're identical).  The content simple looks like this:

// Copyright 2016 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

// +build !go1.6

package main

// This line intentionally does not compile.  This file will only be compiled if
// you are compiling with a version of Go that is lower than the one we support.
var requiredGoVersion = This_project_requires_Go_1_6


If this file is compiled on a version of go that is 1.6 or higher, it'll
get excluded from the build, and all will be well. If you compile it on a
version of go that is lower than 1.6, you'll get an error like this:

./version_canary.go:10: undefined: This_project_requires_Go_1_6

This is (hopefully) a much clearer error message than something like this:

../utils/tls.go:24: undefined: tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384

(which is the error message we used to get if we compiled with an earlier
version of go).

Let me know if you have any questions.  And if someone was still building
1.25 with go 1.2 for the faster compile times... my apologies (but it
wouldn't have worked after today anyway).

-Nate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20160822/d13c5c95/attachment.html>


More information about the Juju-dev mailing list