graduating to go - a jumpstart into the go programming language
TRANSCRIPT
Graduating to GoThe Go Tour and Beyond in 2.5 Hours!
Kaylyn Gibilterra
Software Engineer, Capital One
Overly Enthusiastic About Go
@kgibilterra
Make a friend!
• Where are you from?
• What do you do?
• What technical experience do
you have (coding or not)
• Why are you interested in Go?
• Do you want to be Gopher
friends forever?
Why I love Go
You are already a Gopher
Outline1. Installation
2. Variables & Functions
3. Loops & Conditionals
4. Structs, Arrays, Slices, & Maps
5. Methods & Interfaces
6. Concurrency
7. APIs
Installation
https://golang.org/doc/install
https://play.golang.org/
brew install go
Workspace
Testing Your Installation
• Create $HOME/go/src/hello
• go build
• https://play.golang.org/
Go Syntaxhttps://tour.golang.org
Variables
Variables
Variables(Imports & Exports)
Functions
Functions
Functions
Exercise
• Declare 2 integers, 2 strings, and 2 booleans
• One should be set to it’s zero value and one
should be initialized to whatever you want
• Print out those variables
• Write a function that prints out all of these variables
https://play.golang.org/p/aRwLHoz0Nf
For Loop
For Loop
While Loop
Infinite Loop
If Statements
If Statements
Exercise• Write a function that imports the library “time” to check what time
it is now and print out if it falls inside the time of this conference,
the WIT Experience
• var day := time.Date(Year, Month, Day, Hour, Minute, Second,
Nanosecond, Timezone)
• var now := time.Now()
• in the Play environment, time is always set to:
2009-11-10 23:00:00 +0000 UTC m=+0.000000000
• Convert this into a while loop where the program continually
runs until it is WIT Experience time
https://play.golang.org/p/3BPc7f9ucZ
Exercise
Exercise
Additional Info
Structs, Arrays, Slices,
& Maps
Structs
Arrays
Slices
Arrays & Slices
Slice Range & Append
Maps
Exercise: Quicksort
1. Given an unsorted list:
2. Select a pivot number:
3. Put the pivot in the correct position for the sorted array
with all smaller elements before it, and all greater
elements after:
4. Recursively continue on the smaller and greater halves of
the list:
3 5 2 1 6 4
3 5 2 1 6 4
3 2 1 4 6 5
3 2 1 6 54
https://play.golang.org/p/tk4si__CyW
https://play.golang.org/p/w6QAle3Thq
Methods & Interfaces
Methods
Interfaces
Interfaces
Concurrency
Goroutines
Channels
Channels
Buffered Channel
Write an API
Java
•Jersey
•Spring
•Play Framework
•RestExpress
•Restlet
•Spark Framework
•Kotlin
C/C++
•libmicrohttpd
•jansson
•Kore
Python
•Django
•Tastypie
•Flask
•Falcon
•Bottle
•Eve
API Frameworks
Go Tour - https://tour.golang.org
Books
• Go in Action
• The Go Programming Language
Online Resources
• Go By Example
• Effective Go
• The Go Language Spec
Code
• github.com/golang/go
• github.com/ardanlabs/gotraining
Blogs / Podcasts
• The Go Blog
• Gopher Academy
• Go Time
Gopher Slack - https://invite.slack.golangbridge.org/ #ghc2017
Gopher Resources
Thank you!Kaylyn Gibilterra
@kgibilterra
https://github.com/egonelbre/gophers
https://github.com/ashleymcnamara/gophers
https://github.com/tenntenn/gopher-stickers/tree/master/png
https://github.com/shalakhin/gophericons
Image Credits: