3. EXPLORATIONS
➤ GO /Golang : Programming
Language from Google
➤ Very small language footprint
➤ No multitude of options to
accomplish a task.
➤ Easy to learn, Quick to build stuff.
➤ Tuned for concurrent tasks, multi
core systems, does memory
management too!
➤ Small memory footprint
(compared to Java/Scala)
➤ Availability of packages for most
needs, open source tools / systems
4. “In the Python version, our best shot at making use of all available cores is to run each
publisher and subscriber routine in a separate Python interpreter, each running on a
single OS process.
Go’s goroutines paint an entirely different picture. With only a single pub-sub client,
we’re able to consume all available CPU cores using a single OS process - Go manages
all of the parallelism for you.
-A tale of two queues: http://blog.jupo.org/2013/02/23/a-tale-of-two-queues/
6. HELLO YOU!
➤ functions and data grouped in
packages
➤ One main package and one
main function
➤ import packages
➤ no semi colons
➤ var declaration
➤ inferred type
➤ quick definition
➤ basic data types
➤ Arrays/slices, map, channel
7. DO MORE AT SAME TIME
➤ functions can return multiple
values, last one is always an error
➤ if with no braces, no semi colons,
less to type
➤ neither pure functional nor object
oriented
➤ Anonymous functions/ functions
as values
➤ go routines - do stuff in parallel
➤ defer function - similar to
destructors
➤ panic and recoverWhat is Pr?
8. “No classes and inheritance, still we can get stuff done with types and functions
associated with the type.
Duck typing / Structural typing lets data structures makes data structures and
functions more useful and behaviour driven
No threads /mutexes/semaphores still we can have concurrent processing and co-
ordintation among multiple concurrent processing routines.
9. I MISS MY CLASSES
➤ struct - a custom type that contains
other types (custom / basic)
➤ Any struct member name that starts
with Uppercase letter is public
➤ Any function which specifies a struct as
a receiver of the function call, is similar
to methods of the struct
➤ Note the difference in specifying the
receiver - pass by value/ref
➤ interface - declares the expected
behaviour
➤ No one implements the interface
➤ Any type that has the behaviour
mentioned in the interface
automatically is of the same ‘type’ as
that of the interface.
10. MULTITASKING VIA MESSAGES
➤ Buffered/Blocking channels as
message streams
➤ go routines can send/receive
messages from channels
➤ Use select for receiving
messages from multiple
channels
➤ Simple http server
➤ easy to build and host APIs
echo WebApp
12. GONOTIFY - NOTIFICATION SERVICE
Chat
Services
gonotify*
App
Receive over Websocket
Initiate Chat
NotifyAPIForWebSocket
Time Taken (Including learning Go from Scratch) : 7 days
Redis
13. GOCHECK - PR CHECKER
Time Taken (Including Refreshing Go) : 4 hours
➤ Uses github APIs to pull all
PRs
➤ Validates PR age and
description
➤ Add comments to PR if agent
is more than the threshold
and length of description is
less than the threshold
➤ Cross compiled to run in
Linux box
14. REFERENCES
Chapter 1 will give head start
Refer further chapters on need basis
Available in Safari Books online
http://devslovebacon.com/conferences/bacon-2013/talks/why-node-and-scala-will-dry-
up-go-will-drink-their-milkshake
https://golang.org