Last week Go programmers had a gala time learning, networking and programming at the Marriott Marquis San Diego Marina as the most awaited event GopherCon 2019 was held starting from 24th July till 27th July. GopherCon this year hit the road at San Diego with some exceptional conferences, and many exciting announcements for more than 1800 attendees from around the world.
One of the attendees, Andrea Santillana Fernández, says the Go Community is growing, and doing quite well. She wrote on her blog post on the Source graph website that there are 1 million Go programmers around the world and month on month its membership keeps increasing.
Indeed there is a significant growth in the Go community, so what did it have in store for the programmers at this year’s GopherCon 2019:
On the road to Go 2
The major milestones for the journey to Go 2 were presented by Russ Coxx on Wednesday last week. He explained the main areas of focus for Go 2, which are as below:
Russ notes that writing a program correctly without errors is hard. But writing a program correctly accounting for errors and external dependencies is much more difficult. He listed down a few errors which led in introducing error handling helpers like an optional Unwrap interface, errors.Is and errors.As in Go 1.13 version.
Russ spoke about Generics and said that they started exploring a new design since last year. They are working with programming language theory experts on the problem to help refine the proposal of generics code in Go.
In a separate session, Ian Lance Taylor, introduced generics codes in Go. He briefly explained the need, implementation and benefits from generics for the Go language. Next, Taylor reviewed the Go contract design draft which included the addition of optional type parameters to types and functions.
Taylor defined generics as “Generic programming which enables the representation of functions and data structures in a generic form, with types factored out.”
Generic code is written using types, which are specified later. An unspecified type is called as type parameter. A type parameter offers support only when permitted by contracts.
A generic code imparts strong basis for sharing codes and building programs. It can be compiled using an interface-based approach which optimizes time as the package is compiled only once. If a generic code is compiled multiple times, it can carry compile time cost.
Ian showed a few sample codes written in Generics in Go.
In Go 2 the team wants to focus on Dependency management and explicitly refer to dependencies similar to Java. Russ explained this by giving a history of how in 2011 they introduced GOPATH to separate the distribution from the actual dependencies so that users could run multiple different distributions and to separate the concerns of the distribution from the external libraries.
Then in 2015, they introduced the go vendor spec to formalize the vendor directory and simplify dependency management implementations. But in practice it did not work well. In 2016, they formed the dependency working group. This team started work on dep: a tool to reshape all the existing tools into one.The problem with dep and the vendor directory was multiple distinct incompatible versions of a dependency were represented by one import path. It is now called as the “Import Compatibility Rule”.
The team took what worked well and learned from VGo. VGo provides package uniqueness without breaking builds. VGo dictates different import paths for incompatible package versions.
The team grouped similar packages and gave these groups a name: Modules. The VGo system is now go modules. It now integrates directly with the Go command.
The challenge presented going forward is mostly around updating everything to use modules. Everything needs to be updated to work with the new conventions to work well.
Finally, as a result of all these changes, they distilled and refined the Go toolchain.
One of the examples of this is gopls or “Go Please”. Gopls aims to create a smoother, standard interface to integrate with all editors, IDEs, continuous integration and others.
Simple, portable and efficient graphical interfaces in Go
Elias Naur presented Gio, a new open source Go library for writing immediate mode GUI programs that run on all the major platforms: Android, iOS/tvOS, macOS, Linux, Windows. The talk covered Gio’s unusual design and how it achieves simplicity, portability and performance.
Elias said, “I wanted to be able to write a GUI program in GO that I could implement only once and have it work on every platform. This, to me, is the most interesting feature of Gio.”
— Jaana B. Dogan (@rakyll) July 25, 2019
Elias also presented Scatter which is a Gio program for end-to-end encrypted messaging over email.
Other features of Gio include:
- Immediate mode design
- UI state owned by program
- Only depends on lowest-level platform libraries
- Minimal dependency tree to keep things low level as possible
- GPU accelerated vector and text rendering
- It’s super efficient
- No garbage generated in drawing or layout code
- Cross platform (macOS, Linux, Windows, Android, iOS, tvOS, Webassembly)
- Core is 100% Go while OS-specific native interfaces are optional
Gopls, new tool serves as a backend for Go editor
Rebecca Stambler, mentioned in her presentation that the Go community has built many amazing tools to improve the Go developer experience. However, when a maintainer disappears or a new Go release wreaks havoc, the Go development experience becomes frustrating and complicated. To solve this issue, Rebecca revealed the details behind a new tool: gopls (pronounced as ‘go please’). The tool is currently in development by the Go team and community, and it will ultimately serve as the backend for your Go editor.
Below listed functionalities are expected from gopls:
- Show me errors, like unused variables or typos
- autocomplete would be nice
- function signature help, because we often forget
- While we’re at it, hover-accessible “tooltip” documentation in general
- Help me jump to a variable that is needed to see
- An outline of package structure
Get started with WebAssembly in Go
In a session by Johan Brandhorst who introduces the technology, shows how to get started with WebAssembly and Go, discusses what is possible today and what will be possible tomorrow.
Better x86 assembly generation from Go
Michael McLoughlin in his presentation made the case for code generation techniques for writing x86 assembly from Go. Michael introduced assembly, assembly in Go, the use cases for when you would want to drop into assembly, and techniques for realizing speedups using assembly. He pointed out that most of the time, pure Go will be enough for 97% of programs, but there are those 3% of cases where it is warranted, and the examples he brought up were crypto, syscalls, and scientific computing.
Michael then introduced a package called avo which makes high-performance Go assembly easier to write. He said that writing your assembly in Go will allow you to realize the benefits of a high level language such as code readability, the ability to create loops, variables, and functions, and parameterized code generation all while still realizing the benefits of writing assembly. Michael concluded the talk with his ideas for the future of avo.
- Use avo in projects specifically in large crypto implementations.
- More architecture support
- Possibly make avo an assembler itself (these kinds of techniques are used in JIT compilers)
- avo based libraries (avo/std/math/big, avo/std/crypto)
The audience appreciated this talk on Twitter.
I live-blogged about Ian Lance Taylor's generics talk this #gophercon, but maybe lesser known is also the better x86 assembly talk in Go which was one of my favorites this year by @mbmcloughlin be sure to check out the slideshttps://t.co/sDpBUsVRSl
— Dimitrios Arethas (@darethas) July 28, 2019
The presentation slides for this are available on the blog.
Miniature version of Golang, TinyGo for microcontrollers
Ron Evans, creator of GoCV, GoBot and “technologist for hire” introduced TinyGo that can run directly on microcontrollers like Arduino and more. TinyGo uses the LLVM compiler toolchain to create native code that can run directly even on the smallest of computing devices.
Ron demonstrated how Go code can be run on embedded systems using TinyGo, a compiler intended for use in microcontrollers, WebAssembly (WASM), and command-line tools. Evans began his presentation by countering the idea that Go, while fast, produces executables too large to run on the smallest computers. While that may be true of the standard Go compiler, TinyGo produces much smaller outputs. For example:
“Hello World” program compiled using Go 1.12 => 1.1 MB
Same program compiled using TinyGo 0.7.0 => 12 KB
TinyGo currently lacks support for the full Go language and Go standard library. For example, TinyGo does not have support for the net package, although contributors have created implementations of interfaces that work with the WiFi chip built into Arduino chips. Support for Go Routines is also limited, although simple programs usually work.
Evans demonstrated that despite some limitations, thanks to TinyGo, the Go language can still be run in embedded systems. Salvador Evans, son of Ron Evans, assisted him for this demonstration. At age 11, he has become the youngest GopherCon speaker so far.
— Erik St. Martin (@erikstmartin) July 27, 2019
There were talks by other speakers on topics like, improvements in VSCode for Golang, the first open source Golang interpreter with complete support of the language spec, Athens Project which is a proxy server in Go and how mobile development works in Go.
— Ramya (@ramyanexus) July 27, 2019
🎤 See you today at our #GopherCon Lightning Talk! The talk, "Yaegi, Yet Another Elegant Go Interpreter," presents the first open source #golang interpreter with complete support of the language spec.⚡️https://t.co/hHAREezrE1 #gopherconorbust #golang pic.twitter.com/ML0b2cBHyY
— Containous (@containous) July 27, 2019
— Hajime Hoshi (星一) (@hajimehoshi) July 27, 2019
Apart from these there were a whole lot of other talks which happened at the GopherCon 2019. There were live blogs posted by the attendees on various talks and till now more than 25 blogs are posted by the attendees on the Sourcegraph website.