SlideShare a Scribd company logo
z
Golang
M Dineshkumar
Software Developer
z
History
 Design began in late 2007.
 Key players:
 Robert Griesemer, Rob Pike, Ken Thompson
 Later: Ian Lance Taylor, Russ Cox
 Became open source in November 2009.
 Developed entirely in the open; very active community.
 Language stable as of Go 1, early 2012.
z
Go at Google
 Go is a programming language designed by Google to help
solve Google's problems.
 Google has big problems.
Big Hardware
z
Big software
 C++ (mostly) for servers, plus lots of Java and Python
 thousands of engineers
 gazillions of lines of code
 distributed build system
 And of course:
 zillions of machines, which we treat as a modest number of
compute clusters
 Development at Google can be slow, often clumsy.
z
The reason for Go
Goals:
 eliminate slowness
 eliminate clumsiness
 improve effectiveness
 maintain (even improve) scale
 Go was designed by and for people who write, read, debug and
maintain—large software systems.
 Go's purpose is not research into programming language design.
 Go's purpose is to make its designers' programming lives better.
z
Who uses?
z
What is Go?
Go is:
 open source
 concurrent
 garbage-collected
 efficient
 scalable
 simple
 fun
 boring (to some)
http://golang.org
z
Compiler
 Go is a compiled language, and it has two main compilers, gc
and Gccgo.
z
Purpose
 Efficient compilation
 Efficient execution
 Ease of programming.
z
Go’s ancestors
z
Golang's characteristics
 Goroutine
A Goroutine has a 2kB stack and grow by allocating and freeing
heap storage as required by the program. While threads in other
languages starts with 1MB of storage which is 500 times more than
the stack size of a goroutine.
z
Golang's characteristics
 Concurrency
One of Golang's strongest characteristics is its concurrency.
Concurrency is often confused to be the same as parallelism.
Parallelism is to do many things at once, while concurrency is to
handle many things at once.
z
Golang's characteristics
 Error handling
Many Go-users have been complaining about is how strict the
compiler is about unused variables and packages. The program
wont be compiled if one variable or package is unused forcing the
programmer to have tidy code and maximizing storage usage.
z
Golang's characteristics
 Cgo
Go has a tool called cgo that makes it possible for programs written
in Go to call into C and C++ and in those programs the C or C++
can call back into Go. But there is no support for C or C++ to call
directly to go meaning this does not work for programs that starts
execution in C or C++.
z
Golangs characteristics
 Generics
Generics is a subject that is well discussed in Go. This is something
that is not exactly supported because Go was designed with
simplicity in mind and generics was thought of to be too complex.
There is actually three generic data types in Golang:
Arrays
Slices
Maps
z
Golangs characteristics
 Interfaces
Interfaces in Go works as interfaces in other programming
languages like for example Java, except that you can make use of
the empty interface in Go.
z
Empty Interface
z
Syntax and quirks
 Compilation
In most Go source code files, semicolons won’t be found. This is
because there is no need for the programmer to type them out
since the compiler parses the source code and inserts semicolons
on its own. This makes compilation a bit slower, but the code more
cleaner looking.
z
 Functions
In Go multiple values of same type can be defined as "(x,y int)“.
This means that x and y are two inputs to the function add with the
type int. The text next to the input variables are the output or
returned values of the function. There is something called "naked
returns" in Golang, which is a return followed by nothing. This is
possible due to the naming of the returned value and it’s type in the
declaration of the function.
z
 Pointers in Go
Since Go is built to resemble C and C++, the pointer syntax too is
very similar. A simple example would be seen in example. In the
example it can be seen how the value of the original structure can
be changed by the pointer without dereferencing the pointer.
For example, in C p->x is equivalent to (*p).x and in Golang the
dereferencing is not needed and simply p.x will give the wanted
result.
z
Hello World Example
 A Go program basically consists of the following parts:
 Package Declaration
 Import Packages
 Functions
 Variables
 Statements and Expressions
 Comments
z
z
Executing a Go Program
 Open a text editor and add the above-mentioned code.
 Save the file as hello.go
 Open the command prompt.
 Go to the directory where you saved the file.
 Type go run hello.go and press enter to run your code.
 If there are no errors in your code, then you will see "Hello
World!" printed on the screen.
z
Leaning GO
 Types
 Variables
 Function
 Control Structure
 Object Oriented
 Concurrency
z
Type
 Basic Type
 Boolean
 String
 Byte
 Float
 Constants
z
Type
 Composite Type
 Arrays
 Slices
 Maps
 Structs
 JSONS
 Text and HTML template
z
Variables
z
Static Type Declaration in Go
z
Dynamic Type Declaration
z
Mixed Variable Declaration in Go
z
Constants
z
Arrays
z
Slice
z
Maps
z
Pointers
z
Control Structure
z
Function
z
Function
z
Function
z
Function
z
Object Oriented
 Structs
 Methods
 Interfaces
z
Struct
z
Struct
z
Struct
z
Methods
z
Interface
z
Concurrency
 Goroutine
 Channel
 Select
z
Goroutine
z
Channel
z
Channel
z
Select
In Go language, the select statement is just like switch statement, but in the select
statement, case statement refers to communication, i.e. sent or receive operation on
the channel.
z
This Photo by Unknown Author is licensed under
CC BY-NC-ND

More Related Content

What's hot (17)

PDF
Golang
Felipe Mamud
 
PDF
Go, meet Lua
Andre Burgaud
 
ODP
2#Kotlin programming tutorials(data types and hello world)
Naveen Davis
 
PDF
Golang 101
宇 傅
 
PPTX
Dot net
sd00711
 
PDF
Developing for LinkedIn's Application Platform
Taylor Singletary
 
PDF
Golang, Future of Programming Language.
Sunil Yadav
 
PPT
GO programming language
tung vu
 
PDF
BDD Testing Using Godog - Bangalore Golang Meetup # 32
OpenEBS
 
PPT
Doxygen - Source Code Documentation Generator Tool
Guo Albert
 
PDF
How to contribute textual tooling for apache camel in several id es
Aurélien Pupier
 
PDF
Crystal internals (part 1)
Ary Borenszweig
 
PPTX
C vs c++
ZTE Nepal
 
PDF
The GNOME way - What can we learn from and within the Open Documentation World
Radina Matic
 
PPTX
Graph ql api gateway
AnastasiiaPanchenko3
 
PPTX
Dart presentation
Lucas Leal
 
Golang
Felipe Mamud
 
Go, meet Lua
Andre Burgaud
 
2#Kotlin programming tutorials(data types and hello world)
Naveen Davis
 
Golang 101
宇 傅
 
Dot net
sd00711
 
Developing for LinkedIn's Application Platform
Taylor Singletary
 
Golang, Future of Programming Language.
Sunil Yadav
 
GO programming language
tung vu
 
BDD Testing Using Godog - Bangalore Golang Meetup # 32
OpenEBS
 
Doxygen - Source Code Documentation Generator Tool
Guo Albert
 
How to contribute textual tooling for apache camel in several id es
Aurélien Pupier
 
Crystal internals (part 1)
Ary Borenszweig
 
C vs c++
ZTE Nepal
 
The GNOME way - What can we learn from and within the Open Documentation World
Radina Matic
 
Graph ql api gateway
AnastasiiaPanchenko3
 
Dart presentation
Lucas Leal
 

Similar to Golang introduction (20)

PPTX
Introduction to go lang
Amal Mohan N
 
PPTX
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
PDF
Go lang
Suelen Carvalho
 
PPT
Google's Go Programming Language - Introduction
Ganesh Samarthyam
 
PPTX
go language- haseeb.pptx
ArsalanMaqsood1
 
PPT
Introduction to Go ProgrammingLanguage.ppt
PedroAlexandre215482
 
PDF
Introduction to Go
Simon Hewitt
 
PDF
Inroduction to golang
Yoni Davidson
 
PDF
The GO programming language
Marco Sabatini
 
PPTX
Lab1GoBasicswithgo_foundationofgolang.pptx
stasneemattia
 
PPTX
Should i Go there
Shimi Bandiel
 
PPTX
Google GO
Ajay Gahlot
 
PPTX
The Go Programing Language 1
İbrahim Kürce
 
PDF
Introduction to Programming in Go
Amr Hassan
 
PPTX
Go fundamentals
Ron Barabash
 
PPTX
Golang
Fatih Şimşek
 
PDF
An introduction to programming in Go
David Robert Camargo de Campos
 
PDF
Golang
Saray Chak
 
PPTX
The GO Language : From Beginners to Gophers
I.I.S. G. Vallauri - Fossano
 
PPTX
Go. Why it goes
Sergey Pichkurov
 
Introduction to go lang
Amal Mohan N
 
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
Google's Go Programming Language - Introduction
Ganesh Samarthyam
 
go language- haseeb.pptx
ArsalanMaqsood1
 
Introduction to Go ProgrammingLanguage.ppt
PedroAlexandre215482
 
Introduction to Go
Simon Hewitt
 
Inroduction to golang
Yoni Davidson
 
The GO programming language
Marco Sabatini
 
Lab1GoBasicswithgo_foundationofgolang.pptx
stasneemattia
 
Should i Go there
Shimi Bandiel
 
Google GO
Ajay Gahlot
 
The Go Programing Language 1
İbrahim Kürce
 
Introduction to Programming in Go
Amr Hassan
 
Go fundamentals
Ron Barabash
 
An introduction to programming in Go
David Robert Camargo de Campos
 
Golang
Saray Chak
 
The GO Language : From Beginners to Gophers
I.I.S. G. Vallauri - Fossano
 
Go. Why it goes
Sergey Pichkurov
 
Ad

Recently uploaded (20)

PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Ad

Golang introduction

  • 2. z History  Design began in late 2007.  Key players:  Robert Griesemer, Rob Pike, Ken Thompson  Later: Ian Lance Taylor, Russ Cox  Became open source in November 2009.  Developed entirely in the open; very active community.  Language stable as of Go 1, early 2012.
  • 3. z Go at Google  Go is a programming language designed by Google to help solve Google's problems.  Google has big problems.
  • 5. z Big software  C++ (mostly) for servers, plus lots of Java and Python  thousands of engineers  gazillions of lines of code  distributed build system  And of course:  zillions of machines, which we treat as a modest number of compute clusters  Development at Google can be slow, often clumsy.
  • 6. z The reason for Go Goals:  eliminate slowness  eliminate clumsiness  improve effectiveness  maintain (even improve) scale  Go was designed by and for people who write, read, debug and maintain—large software systems.  Go's purpose is not research into programming language design.  Go's purpose is to make its designers' programming lives better.
  • 8. z What is Go? Go is:  open source  concurrent  garbage-collected  efficient  scalable  simple  fun  boring (to some) http://golang.org
  • 9. z Compiler  Go is a compiled language, and it has two main compilers, gc and Gccgo.
  • 10. z Purpose  Efficient compilation  Efficient execution  Ease of programming.
  • 12. z Golang's characteristics  Goroutine A Goroutine has a 2kB stack and grow by allocating and freeing heap storage as required by the program. While threads in other languages starts with 1MB of storage which is 500 times more than the stack size of a goroutine.
  • 13. z Golang's characteristics  Concurrency One of Golang's strongest characteristics is its concurrency. Concurrency is often confused to be the same as parallelism. Parallelism is to do many things at once, while concurrency is to handle many things at once.
  • 14. z Golang's characteristics  Error handling Many Go-users have been complaining about is how strict the compiler is about unused variables and packages. The program wont be compiled if one variable or package is unused forcing the programmer to have tidy code and maximizing storage usage.
  • 15. z Golang's characteristics  Cgo Go has a tool called cgo that makes it possible for programs written in Go to call into C and C++ and in those programs the C or C++ can call back into Go. But there is no support for C or C++ to call directly to go meaning this does not work for programs that starts execution in C or C++.
  • 16. z Golangs characteristics  Generics Generics is a subject that is well discussed in Go. This is something that is not exactly supported because Go was designed with simplicity in mind and generics was thought of to be too complex. There is actually three generic data types in Golang: Arrays Slices Maps
  • 17. z Golangs characteristics  Interfaces Interfaces in Go works as interfaces in other programming languages like for example Java, except that you can make use of the empty interface in Go.
  • 19. z Syntax and quirks  Compilation In most Go source code files, semicolons won’t be found. This is because there is no need for the programmer to type them out since the compiler parses the source code and inserts semicolons on its own. This makes compilation a bit slower, but the code more cleaner looking.
  • 20. z  Functions In Go multiple values of same type can be defined as "(x,y int)“. This means that x and y are two inputs to the function add with the type int. The text next to the input variables are the output or returned values of the function. There is something called "naked returns" in Golang, which is a return followed by nothing. This is possible due to the naming of the returned value and it’s type in the declaration of the function.
  • 21. z  Pointers in Go Since Go is built to resemble C and C++, the pointer syntax too is very similar. A simple example would be seen in example. In the example it can be seen how the value of the original structure can be changed by the pointer without dereferencing the pointer. For example, in C p->x is equivalent to (*p).x and in Golang the dereferencing is not needed and simply p.x will give the wanted result.
  • 22. z Hello World Example  A Go program basically consists of the following parts:  Package Declaration  Import Packages  Functions  Variables  Statements and Expressions  Comments
  • 23. z
  • 24. z Executing a Go Program  Open a text editor and add the above-mentioned code.  Save the file as hello.go  Open the command prompt.  Go to the directory where you saved the file.  Type go run hello.go and press enter to run your code.  If there are no errors in your code, then you will see "Hello World!" printed on the screen.
  • 25. z Leaning GO  Types  Variables  Function  Control Structure  Object Oriented  Concurrency
  • 26. z Type  Basic Type  Boolean  String  Byte  Float  Constants
  • 27. z Type  Composite Type  Arrays  Slices  Maps  Structs  JSONS  Text and HTML template
  • 42. z Object Oriented  Structs  Methods  Interfaces
  • 52. z Select In Go language, the select statement is just like switch statement, but in the select statement, case statement refers to communication, i.e. sent or receive operation on the channel.
  • 53. z This Photo by Unknown Author is licensed under CC BY-NC-ND

Editor's Notes

  • #3: 2007- Started as a part-time project 2008 – A lot of other people help them to bring go from prototype to reality. 2009 – Go become a public opensource project 2010 – Programmers starts to adopt go.
  • #6: Google has two tremendous problems. One of them is compile time. Back in the 1980’s, reasonable sized projects took hours to do a clean build. Google’s other problem is string processing. Google reads and analyzes a lot of web pages, which are text files. They do a lot of string manipulation, so it pays for this to be really efficient.
  • #7: Go is designed for quick compilation without the need for dependency checking, so it addresses the build pain. Google built a rich library of string functions into Go, Garbage collecting makes strings in Go simple to think about, and efficient in ways some other string libraries are not (I’m talking to you, C++ committee).
  • #9: Opensource in 2009  in concurrent systems, multiple actions can be in progress (may not be executed) at the same time multiple actions are simultaneously executed in parallel systems.
  • #10: The other compiler, Gccgo, has a front end that is written in C++, and a back end that is coupled to the standard GCC compiler. This allows Go to use interoperability with both C and C++ using the extern "C". The Go team has written two different compilers that implement that spec: gc and gccgo. Gc is the standard compiler, and the go tool uses it by default. it was originally written in C, but as of Go 1.5 it is now written in Go. Gccgo , has a front end that is written in C++ and a back end that is coupled to the standard GCC compiler. This allows Go to use interoperability with both C and C++ using the extern "C". Compared to gc, gccgo is slower to compile code but supports more powerful optimizations, so a CPU-bound program built by gccgo will usually run faster.
  • #11: Developers at Google wanted a good scalable language when working with large systems, and the developer had to choose either between efficient compilation, efficient execution or ease of programming. The developers at Google found that there was no mainstream programming language that consisted of all these three. So the purpose of Go(Golang) is trying to combine all these three into one language
  • #12: Go has inherited most of it’s basic syntax from C and C++ but with imports and packages instead of includes like in the C languages. There are a few other programming languages that it has inherited ideas from as well, such as Pascal, Modula and Oberon, and also Limbo from where it got it’s concurrency features. Even though Go has resemblances with other programming languages it’s a completely new language, with the main feature being making normal programming more efficient.
  • #13: In Golang a goroutine is what in Java would be called a thread. Goroutines are light weight threads, because their memory consumption is minimal compared to the language it has used its inspiration from, C and C++. A Goroutine has a 2kB stack and grow by allocating and freeing heap storage as required by the program. While threads in other languages starts with 1MB of storage which is 500 times more than the stack size of a goroutine. An example of go’s superiority is a server handling connecting clients. The server would create a thread for each incoming connection which would eventually lead to a OutOfMemoryError. Goroutines which takes uses very little memory would not face this problem. This is a problem with every programming language that uses OS threads as a way to handle concurrency.
  • #17: These are data types which can be instantiated on arbitrary element types. But there is a way to go around the needs of generics, and that is to use something called interfaces. Interfaces define behavior without requiring implementation details.
  • #18: For example, if you write a function with the empty interface as a parameter this function will work for any type of that parameter.
  • #22: Another handy thing implemented for pointers is that, if you directly print the pointer, it will print and show which values it’s pointing to but with & before the values. Dereferencing that pointer would end with same result but no & in front of the pointed value.