go generate

Code generation lands in the toolchain

25 September 2014

Kevin Gillette

Introduction

2

Running generate

go generate [-run regexp] [file.go...|packagepath...]
3

Directives

package library

//go:generate program -o output.go args...
4

Shorthand directives

package library

//go:generate -command say echo one two

//go:generate say three four
//go:generate -command echo echo one two

//go:generate echo three four
5

Use cases

6

Further Reading

7

Thank you

Use the left and right arrow keys or click the left and right edges of the page to navigate between slides.
(Press 'H' or navigate to hide this message.)