SlideShare a Scribd company logo
1 of 25
Download to read offline
Spandana Govindgari
GETTING STARTED: GOLANG
Remember your first hello world program?
Then things got a little bit complex…..
WHAT IS GO?
➤ Statically-typed (with some dynamic characteristics), concurrent,
quickly compiled & garbage-collected language that generates docs
automatically!
➤ Developed by Google in 2007 by Rob Pike, Ken Thompson and Robert
Greisemer
➤ Who is using it? https://github.com/golang/go/wiki/GoUsers
PHILOSOPHY
➤ “Go is intended to be fast: it should take at most a few seconds
to build a large executable on a single computer.”
➤ Avoid overhead of C-style languages of include files and
libraries
➤ Make types feel more lightweight in Go than in OOP language
like Java
➤ Combine features of dynamically typed languages
WHAT’S GOOD ABOUT GO?
➤ Fast build times, single binary deployment, built in formatting, great tooling, built in
test framework, multi-arch build, low-level interface, race detector, visual profilers,
and a nice concurrency model
➤ Imperative programming style & procedural paradigm
➤ Concurrency (dealing with lot of things at once) & Parallelism (doing a lot of things
at once)
➤ Remote package management (go get github.com/<username>/<repo>)
➤ Great for backend services, process heavy stuff, non blocking IO, service calls
➤ Comes with a cost: no exceptions & assertions, enter pointers, structs and variable
declaration
GO BIG OR GO HOME
go tools
101: INTRO TO GO
Source is UTF-8
No semicolons or rules related to tabs or
spacing like Python
Parenthesis are not required except for
argument lists
Includes all familiar types including support for
int8, uint32, float64, etc.
Strings are immutable
Only control statements are if, for, switch, and
defer
All memory in Go is initialized (un-initialized
variables are of "zero value")
Runs on the i386, amd64, and ARM architectures
with the "gc" compilers
Declarations are reversed with type at end,
supports multiple assignment, shorthand
declarations with functions only
More useful Go features: slices, defer, iota, and
the blank identifier “_"
Garbage collection is performed by mark-and-
sweep
INTERFACES, STRUCTS & EMBEDDING
CONCURRENCY
➤ goroutines (execution)
➤ Do not communicate by sharing
memory but instead share
memory by communicating
➤ Functions executing concurrently
with others in the same address
space
➤ Channels (sync & message)
➤ Asynchronously (buffered) or
synchronously (unbuffered) send
data between two goroutines
PING PONG EXAMPLE
WHAT’S BAD ABOUT GO?
➤ Not quite OOP means no concept of inheritance and polymorphism
➤ No support for overloading of methods and operators
➤ No pointer arithmetic and implicit type conversions
➤ No support for Generics/Templates
➤ Instead relies on built in maps, slices and explicit unboxing to provide similar
functionality
➤ Type inheritance is not supported
➤ Types automatically satisfy any interface that specifies a subset of its methods.
LESS IS EXPONENTIALLY MORE
➤ http://awesome-go.com/
➤ https://github.com/golang/go/wiki
➤ http://www.slideshare.net/harshad0402/golang-getting-started
➤ http://www.slideshare.net/SvtBozhko/golang-from-scala-developers-perspective
➤ http://www.slideshare.net/kartiksura/wonders-of-golang
➤ http://www.slideshare.net/laogianoel/golang-5-to-go-or-not-to-go
➤ http://spaces-vs-tabs.com/4-weeks-of-golang-the-good-the-bad-and-the-ugly/
➤ http://yager.io/programming/go.html
➤ https://golang.org/doc/faq
➤ https://www.cs.colorado.edu/~kena/classes/5828/s12/presentation-materials/
smithbrentgibsonleon.pdf

More Related Content

What's hot

What's hot (20)

Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golang
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
Why you should care about Go (Golang)
Why you should care about Go (Golang)Why you should care about Go (Golang)
Why you should care about Go (Golang)
 
Golang
GolangGolang
Golang
 
Go Lang Tutorial
Go Lang TutorialGo Lang Tutorial
Go Lang Tutorial
 
Introduction to GoLang
Introduction to GoLangIntroduction to GoLang
Introduction to GoLang
 
Go lang
Go langGo lang
Go lang
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
Golang 101
Golang 101Golang 101
Golang 101
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / Overview
 
Concurrency With Go
Concurrency With GoConcurrency With Go
Concurrency With Go
 
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
 
GO programming language
GO programming languageGO programming language
GO programming language
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
 
Goroutines and Channels in practice
Goroutines and Channels in practiceGoroutines and Channels in practice
Goroutines and Channels in practice
 
Golang Template
Golang TemplateGolang Template
Golang Template
 

Similar to GoLang Introduction

Similar to GoLang Introduction (20)

An Introduction to Go
An Introduction to GoAn Introduction to Go
An Introduction to Go
 
Go: What's Different ?
Go: What's Different ?Go: What's Different ?
Go: What's Different ?
 
Go fundamentals
Go fundamentalsGo fundamentals
Go fundamentals
 
Golang from Scala developer’s perspective
Golang from Scala developer’s perspectiveGolang from Scala developer’s perspective
Golang from Scala developer’s perspective
 
Number of Computer Languages = 3
Number of Computer Languages = 3Number of Computer Languages = 3
Number of Computer Languages = 3
 
AddisDev Meetup ii: Golang and Flow-based Programming
AddisDev Meetup ii: Golang and Flow-based ProgrammingAddisDev Meetup ii: Golang and Flow-based Programming
AddisDev Meetup ii: Golang and Flow-based Programming
 
Evolution or stagnation programming languages
Evolution or stagnation programming languagesEvolution or stagnation programming languages
Evolution or stagnation programming languages
 
Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?
 
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
 
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
 
Introduction to Google's Go programming language
Introduction to Google's Go programming languageIntroduction to Google's Go programming language
Introduction to Google's Go programming language
 
Static analysis for beginners
Static analysis for beginnersStatic analysis for beginners
Static analysis for beginners
 
Wonders of Golang
Wonders of GolangWonders of Golang
Wonders of Golang
 
The Go features I can't live without, 2nd round
The Go features I can't live without, 2nd roundThe Go features I can't live without, 2nd round
The Go features I can't live without, 2nd round
 
Log Management Systems
Log Management SystemsLog Management Systems
Log Management Systems
 
Golang : A Hype or the Future?
Golang : A Hype or the Future?Golang : A Hype or the Future?
Golang : A Hype or the Future?
 
Ruxmon.2013-08.-.CodeBro!
Ruxmon.2013-08.-.CodeBro!Ruxmon.2013-08.-.CodeBro!
Ruxmon.2013-08.-.CodeBro!
 
Introduction to Programming in Go
Introduction to Programming in GoIntroduction to Programming in Go
Introduction to Programming in Go
 
Let's Go
Let's GoLet's Go
Let's Go
 
Go programming language
Go programming languageGo programming language
Go programming language
 

More from Spandana Govindgari (7)

Recap: OSCON 2015
Recap: OSCON 2015Recap: OSCON 2015
Recap: OSCON 2015
 
Case for Diversity In Tech
Case for Diversity In TechCase for Diversity In Tech
Case for Diversity In Tech
 
Making a computer play Tetris
Making a computer play TetrisMaking a computer play Tetris
Making a computer play Tetris
 
Case for cornellitix outsourcing
Case for cornellitix outsourcingCase for cornellitix outsourcing
Case for cornellitix outsourcing
 
Sensors for detection
Sensors for detectionSensors for detection
Sensors for detection
 
Playful Presentation
Playful PresentationPlayful Presentation
Playful Presentation
 
Calculus BC
Calculus BCCalculus BC
Calculus BC
 

Recently uploaded

"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
chumtiyababu
 

Recently uploaded (20)

Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 

GoLang Introduction

  • 2. Remember your first hello world program?
  • 3. Then things got a little bit complex…..
  • 4.
  • 5. WHAT IS GO? ➤ Statically-typed (with some dynamic characteristics), concurrent, quickly compiled & garbage-collected language that generates docs automatically! ➤ Developed by Google in 2007 by Rob Pike, Ken Thompson and Robert Greisemer ➤ Who is using it? https://github.com/golang/go/wiki/GoUsers
  • 6.
  • 7.
  • 8. PHILOSOPHY ➤ “Go is intended to be fast: it should take at most a few seconds to build a large executable on a single computer.” ➤ Avoid overhead of C-style languages of include files and libraries ➤ Make types feel more lightweight in Go than in OOP language like Java ➤ Combine features of dynamically typed languages
  • 9. WHAT’S GOOD ABOUT GO? ➤ Fast build times, single binary deployment, built in formatting, great tooling, built in test framework, multi-arch build, low-level interface, race detector, visual profilers, and a nice concurrency model ➤ Imperative programming style & procedural paradigm ➤ Concurrency (dealing with lot of things at once) & Parallelism (doing a lot of things at once) ➤ Remote package management (go get github.com/<username>/<repo>) ➤ Great for backend services, process heavy stuff, non blocking IO, service calls ➤ Comes with a cost: no exceptions & assertions, enter pointers, structs and variable declaration
  • 10. GO BIG OR GO HOME go tools
  • 11. 101: INTRO TO GO Source is UTF-8 No semicolons or rules related to tabs or spacing like Python Parenthesis are not required except for argument lists Includes all familiar types including support for int8, uint32, float64, etc. Strings are immutable Only control statements are if, for, switch, and defer All memory in Go is initialized (un-initialized variables are of "zero value") Runs on the i386, amd64, and ARM architectures with the "gc" compilers Declarations are reversed with type at end, supports multiple assignment, shorthand declarations with functions only More useful Go features: slices, defer, iota, and the blank identifier “_" Garbage collection is performed by mark-and- sweep
  • 12.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. CONCURRENCY ➤ goroutines (execution) ➤ Do not communicate by sharing memory but instead share memory by communicating ➤ Functions executing concurrently with others in the same address space ➤ Channels (sync & message) ➤ Asynchronously (buffered) or synchronously (unbuffered) send data between two goroutines
  • 23. WHAT’S BAD ABOUT GO? ➤ Not quite OOP means no concept of inheritance and polymorphism ➤ No support for overloading of methods and operators ➤ No pointer arithmetic and implicit type conversions ➤ No support for Generics/Templates ➤ Instead relies on built in maps, slices and explicit unboxing to provide similar functionality ➤ Type inheritance is not supported ➤ Types automatically satisfy any interface that specifies a subset of its methods.
  • 25. ➤ http://awesome-go.com/ ➤ https://github.com/golang/go/wiki ➤ http://www.slideshare.net/harshad0402/golang-getting-started ➤ http://www.slideshare.net/SvtBozhko/golang-from-scala-developers-perspective ➤ http://www.slideshare.net/kartiksura/wonders-of-golang ➤ http://www.slideshare.net/laogianoel/golang-5-to-go-or-not-to-go ➤ http://spaces-vs-tabs.com/4-weeks-of-golang-the-good-the-bad-and-the-ugly/ ➤ http://yager.io/programming/go.html ➤ https://golang.org/doc/faq ➤ https://www.cs.colorado.edu/~kena/classes/5828/s12/presentation-materials/ smithbrentgibsonleon.pdf