GopherCon 2019 - On the Road to Go 2
These are some notes from my experiences at the GopherCon 2019. I don’t expect these will be laid out in any particularly useful way; I am mostly taking them so I can remember some of the bits I found most useful in the future.
Go 2 Big Topics
- Errors
- Generics
- Dependencies
- Developer tooling
Errors
-
Error values
- Nice to enable full use of go language to extend and inspect errors
- go1.13 – errors should have
Unwrap()
(similar toCause()
), handled byerrors.Unwrap(err)
- go1.13 – errors.Is(), errors.As() for handling some looping w/ Unwrap
- go1.13 –
%w
formatting for error wrapping w/fmt.Errorf()
-
Error syntax
- abadoned
check
andtry
(woo!)
- abadoned
Generics
- contract-based design from last year still experimenting, but not settled
- latest design presented Friday morning
Dependencies
-
History
-
just go distribution (but no easy custom packages)
-
GOPATH (but no versioning)
-
Go vendoring (copy dependencies into your tree without hacks)
- But lost package uniqueness
-
Dep – hoping to unify various other tools
- But supported incompatible changes to a dep w/o changing import paths
-
Vgo / Go Modules – restore “New API == new import path”
- But no more GOPATH
- But we do get more reproducible builds as a result of no more GOPATH
- Separates VCS from packages, so proxies are now viable
- go1.13 will use the google proxy by default in modules mode
-
Developer Tools
- Probably a focus after the other 3 topics when there aren’t a lot of language changes on deck
- E.g.,
gopls
- Probably
fix
andvet
after