Go Language for Ops and Site Reliability Engineering
Gustavo Franco
Site Reliability Engineer, Google
Gustavo Franco
Site Reliability Engineer, Google
Operations
Site Reliability Engineering
"Go is an open source programming environment that makes it easy to build simple,
reliable, and efficient software." -- golang.org
package main import ( "flag" "fmt" ) var message = flag.String("message", "Hello, OSCON!", "what to say") func main() { flag.Parse() fmt.Println(*message) }
$ go run hello.go -help Usage of /tmp/go-build212699297/command-line-arguments/_obj/a.out: -message="Hello, OSCON!": what to say exit status 2
pkg.go.dev to your needs beyond the standard library
10package main import ( "fmt" "time" ) func main() { go say("ho!", 2*time.Second) // & go say("hey!", 1*time.Second) // & // Make main sleep for 4 seconds so goroutines can finish time.Sleep(4 * time.Second) } // say prints text after sleeping for X secs func say(text string, secs time.Duration) { time.Sleep(secs) fmt.Println(text) }
// +build ignore,OMIT
package main
import (
"fmt"
"time"
)
func main() { textChannel := make(chan string) words := []string{"ho!", "hey!"} secs := []int{2, 1} // Create a goroutine per word for i, word := range words { go say(word, secs[i], textChannel) // & } // Wait for response via channel N times for _ = range words { fmt.Println(<-textChannel) } } // say sends word back via channel after sleeping for X secs func say(word string, secs int, textChannel chan string) { time.Sleep(time.Duration(secs) * time.Second) textChannel <- word }
Go grows with you - see interfaces and reflection
13dl.google.com - OSCON talk by Brad Fitzpatrick Friday, 10:00am
vtocc: front-end to MySQL that improves scalability
Whitebox monitoring data from logs to a timeseries database
Command line library for Go
Machine lifecycle management
via App Engine
14Unix-like pipelines for Go
Inter host Goroutines
Service orchestration management tool
Containers management tool
Tool for creating identical machine images for multiple platforms
Take the tour - [[tour.golang.org]]