Things which may be of interest in Go v1.4
Katherine Cox-Buday
katherine.cox-buday at canonical.com
Thu Dec 11 16:21:11 UTC 2014
Hey All,
I just got done reading through the Go v1.4 release-notes[1], and these are
some high-level thoughts about what pieces may be of interest to Juju
development. This is certainly not comprehensive, but I thought you all
might be interested. Happy release day :)
-
*go generate *https://golang.org/doc/go1.4#gogenerate
This is *very* powerful and could reduce the number of copy/paste
snippets, or unsafe reflection code we have to write. For those of you who
are familiar with the lisps, this is essentially macros. You write code
that examines Go expressions and does something. This code is
triggered by *//go:generate
command arg* comments in the code. As a quick example, our StringSet
type could be generated and even expanded to encompass any type.
-
*New func TestMain(m *testing.M) *https://golang.org/pkg/testing/#MainStart
Since we use gocheck and gocheck requires you to register the testing
subsystem, this now looks like the best place to do this. Without this, you
can run into difficult to debug behavior when filtering to certain subsets
of tests, or duplication of registration.
- *Canonical Import Paths*
https://golang.org/doc/go1.4#canonicalimports
This helps out when using the gopkg.in pattern. For libraries that are
specific to Juju, we may want to specify this to help enforce the notion
that we want to use gopkg.in and not github.com/* or launchpad.net/*.
- *Internal Packages*
https://golang.org/doc/go1.4#internalpackages
Just what it sounds like. We can now hide implementation details from
importers. Probably more useful for the ancillary Juju packages as Juju
Core is probably not imported very much.
-
Katherine
[1] https://golang.org/doc/go1.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20141211/8b8941f3/attachment.html>
More information about the Juju-dev
mailing list