BACKED BY Microsoft Ventures | Lightspeed | Shlomo Kramer | TLV Partners
Boston San Francisco
Tel Aviv 3
Gotcha #1: JSON Memory Leak ◼ JavaScript Object Notation ◼ Lightweight data-interchange format ◼ Easy to read and write – even in GO!
◼ You’re using the JSON package wrong
4
Gotcha #1: JSON Memory Leak
Let’s code...
5
Gotcha #2: Static Functions ◼ Is Go Object-Oriented? Yes and no ◼ Object-Oriented programming style ◼ Methods are more generic than in
C++ or Java ◼ Function of uninitiated structure?
Static function
6
Gotcha #2: Static Functions
Let’s code...
7
Gotcha #3: Buffered Channels != Queues ◼ Communicating Sequential Processes ◼ Channels – First class values ◼ Channels – Unbuffered or buffered ◼ Buffered channels block too
8
Gotcha #3: Channels != Queues
Let’s code...
9
Gotcha #4: Don’t Panic! ◼ Errors – The idiomatic way of dealing
with abnormal conditions ◼ Panic – Program cannot continue
execution ◼ Recover – Regain control from a
panic goroutine ◼ Recover only from within goroutine
10
Gotcha #4: Don’t Panic!
Let’s code...
11
Gotcha #5: Type Magic – Type Overloading ◼ Go is a strictly typed language ◼ Variables can only carry values of the
type they were declared to be ◼ Composite types ("unnamed types"):
Building blocks for new types ◼ Declare types by binding an identifier to
an existing underlying type
12
Gotcha #5: Type Magic – Type Overloading
Let’s code...
13
Gotcha #5: Type Magic – Type Casting ◼ Go is a strictly typed language ◼ Values can be cast into other types ◼ Casting does not always work ◼ Casting fails silently
14
Gotcha #5: Type Magic – Type Casting
Let’s code...
15
For additional info ◼ Our Resource Center: www.aquasec.com/resources/
◼ The world’s only container Wiki: www.aquasec.com/wiki
16
Thank You
Go gopher drawings provided by https://github.com/egonelbre/gophers, under CC0. The Go gopher was designed by Renee French. The Gopher character design is licensed under the Creative Commons 3.0 Attributions license.