SlideShare a Scribd company logo
A gentle intro to Golang and the Go-universe
Alex-P. Natsios
GoCode.Thessaly(7)
28 feb 2014
Alex-P. Natsios A gentle intro to Golang and the Go-universe
The Language
Alex-P. Natsios A gentle intro to Golang and the Go-universe
A few words about GO
Go, also called golang, was initially developed at google in 2007
and announced in 2009 but most of its popularity boost (and hype)
came much later with its first stable release (1.0) on 28 Mar 2012.
Characteristics:
Compiled
Statically typed and garbage collected
Object Oriented (but not in the usual way)
Sane Concurrency
Fast Compilers
Rich Standard Library
Scalable Tools
Alex-P. Natsios A gentle intro to Golang and the Go-universe
The Gopher!
Alex-P. Natsios A gentle intro to Golang and the Go-universe
The Classic Example
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
Alex-P. Natsios A gentle intro to Golang and the Go-universe
Packages
Go code lives in packages.
A package consists of one or more source(.go) files.
Typically all files belonging to a package are placed in the
same directory.
Visibility is determined by case: Foo is exported, foo is not.
Alex-P. Natsios A gentle intro to Golang and the Go-universe
Declarations
import “fmt”
const answer = 42
var something [10]byte
var names = []string {“Alex”, “George”, “Maria” }
Alex-P. Natsios A gentle intro to Golang and the Go-universe
Types
All basic types you would expect to have.
But string is a basic type.
No pointer arithmetic.
New (or not exactly that new) types:
Slices: Much like many other modern languages, []int
Maps: Because suddenly everybody needs them,
map[string]int
Interfaces: for Polymorphism, interface{}
Channels: Used to communicate with goroutines, chan int
Alex-P. Natsios A gentle intro to Golang and the Go-universe
Scope
Universe
Package
File (for imports)
Function
Block
Alex-P. Natsios A gentle intro to Golang and the Go-universe
Concurrency
Concurrency is a property of systems in which several
computations are executing simultaneously and potentialy
interacting with each other.
WARNING: Concurrency is NOT parallelism, although it enables
parallelism if you have a multiprocessor system.
Alex-P. Natsios A gentle intro to Golang and the Go-universe
Goroutines
Independently executing functions, launched by a go
statement.
NOT threads.
VERY cheap, you might have thousands of goroutines running
under the same thread.
Have their own dynamic call stack (growning and shrinking as
needed).
Alex-P. Natsios A gentle intro to Golang and the Go-universe
Channels
A channel provides a connection between goroutines, allowing
communication.
Channels can be unbuffered or buffered, so they both communicate
and synchronize.
Buffered channels are asynchronous.
Alex-P. Natsios A gentle intro to Golang and the Go-universe
Channels
Code Example
package main
import "fmt"
func main() {
greetings := make(chan string, 2)
go func() {
greetings <- "Hello"
greetings <- "World!"
}()
greet1 := <-greetings
greet2 := <-greetings
fmt.Println(greet1, greet2)
}
Alex-P. Natsios A gentle intro to Golang and the Go-universe
Channels
cont.
When in main(), “<-greetings” is executed it waits for a value to
be sent.
Same goes for our anonymous function that expects a reciever to
be in place in order for the greetings to be sent.
If no sender/receiver is ready (they both must be) then we wait
until they are!
Alex-P. Natsios A gentle intro to Golang and the Go-universe
The Toolchain
Alex-P. Natsios A gentle intro to Golang and the Go-universe
The go tool
go build - To compile the package.
go get - To resolve and install deps.
go test - To run the test suite and benchmarks.
go install - To install the package.
go doc - To generate documentation.
go fmt - To properly format your code.
go run - To build and run the app.
go tool - To run extra tools.
and more (properly “integrated” in the go tool)
Alex-P. Natsios A gentle intro to Golang and the Go-universe
Building and workspaces
A GO program can be compiled and linked without additional
build info. A single tool can compile either individual files or entire
systems.
In order to work without build scripts a certain directory structure
MUST be followed.
workspace
workspace/
bin/
pkg/
src/
Alex-P. Natsios A gentle intro to Golang and the Go-universe
workspaces
cont.
Creating a workspace:
mkdir -p $HOME/GoCode/{bin, pkg, src}
Telling go about it:
export GOPATH=“$HOME/GoCode”
export PATH=“$PATH:$GOPATH/bin”
Alex-P. Natsios A gentle intro to Golang and the Go-universe
Links
Golang homepage:
golang.org
Go tour:
tour.golang.org
Package Doc:
golang.org/pkg
A little outdated but still useful page:
go-lang.cat-v.org
Obligatory subreddit:
reddit.com/r/golang/
Alex-P. Natsios A gentle intro to Golang and the Go-universe
Thank you for your attention!
Alex-P. Natsios
drakevr@2f30.org
http://drakevr.gr
http://www.linkedin.com/in/drakevr
http://www.github.com/drakevr
http://www.facebook.com/drakevr
http://www.twitter.com/drakevr
Alex-P. Natsios A gentle intro to Golang and the Go-universe

More Related Content

What's hot

funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
sangam biradar
 
Golang from Scala developer’s perspective
Golang from Scala developer’s perspectiveGolang from Scala developer’s perspective
Golang from Scala developer’s perspective
Sveta Bozhko
 
Decision making - for loop , nested loop ,if-else statements , switch in goph...
Decision making - for loop , nested loop ,if-else statements , switch in goph...Decision making - for loop , nested loop ,if-else statements , switch in goph...
Decision making - for loop , nested loop ,if-else statements , switch in goph...
sangam biradar
 
Golang
GolangGolang
Golang
Felipe Mamud
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?
sangam biradar
 
Golang
GolangGolang
Golang online course
Golang online courseGolang online course
Golang online course
bestonlinecoursescoupon
 
Golang
GolangGolang
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Aniruddha Chakrabarti
 
Golang for PHP programmers: A practical introduction
Golang for PHP programmers: A practical introductionGolang for PHP programmers: A practical introduction
Golang for PHP programmers: A practical introduction
Richard Tuin
 
Geek Talk Backend Unit Testing in Go Language
Geek Talk Backend Unit Testing in Go LanguageGeek Talk Backend Unit Testing in Go Language
Geek Talk Backend Unit Testing in Go Language
Haluan Irsad
 
Optimizing and Profiling Golang Rest Api
Optimizing and Profiling Golang Rest ApiOptimizing and Profiling Golang Rest Api
Optimizing and Profiling Golang Rest Api
Iman Syahputra Situmorang
 
10 reasons to be excited about go
10 reasons to be excited about go10 reasons to be excited about go
10 reasons to be excited about go
Dvir Volk
 
Coding with golang
Coding with golangCoding with golang
Coding with golang
HannahMoss14
 
Git
GitGit
13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications
Karthik Gaekwad
 
Golang workshop
Golang workshopGolang workshop
Golang workshop
Victor S. Recio
 
Building Command Line Tools with Golang
Building Command Line Tools with GolangBuilding Command Line Tools with Golang
Building Command Line Tools with Golang
Takaaki Mizuno
 
Understanding how concurrency work in os
Understanding how concurrency work in osUnderstanding how concurrency work in os
Understanding how concurrency work in os
GenchiLu1
 

What's hot (20)

funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
 
Golang from Scala developer’s perspective
Golang from Scala developer’s perspectiveGolang from Scala developer’s perspective
Golang from Scala developer’s perspective
 
Decision making - for loop , nested loop ,if-else statements , switch in goph...
Decision making - for loop , nested loop ,if-else statements , switch in goph...Decision making - for loop , nested loop ,if-else statements , switch in goph...
Decision making - for loop , nested loop ,if-else statements , switch in goph...
 
Golang
GolangGolang
Golang
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?
 
Golang
GolangGolang
Golang
 
Golang online course
Golang online courseGolang online course
Golang online course
 
Golang
GolangGolang
Golang
 
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
 
Golang for PHP programmers: A practical introduction
Golang for PHP programmers: A practical introductionGolang for PHP programmers: A practical introduction
Golang for PHP programmers: A practical introduction
 
Geek Talk Backend Unit Testing in Go Language
Geek Talk Backend Unit Testing in Go LanguageGeek Talk Backend Unit Testing in Go Language
Geek Talk Backend Unit Testing in Go Language
 
Optimizing and Profiling Golang Rest Api
Optimizing and Profiling Golang Rest ApiOptimizing and Profiling Golang Rest Api
Optimizing and Profiling Golang Rest Api
 
10 reasons to be excited about go
10 reasons to be excited about go10 reasons to be excited about go
10 reasons to be excited about go
 
Coding with golang
Coding with golangCoding with golang
Coding with golang
 
Git
GitGit
Git
 
13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications
 
Golang workshop
Golang workshopGolang workshop
Golang workshop
 
Building Command Line Tools with Golang
Building Command Line Tools with GolangBuilding Command Line Tools with Golang
Building Command Line Tools with Golang
 
Understanding how concurrency work in os
Understanding how concurrency work in osUnderstanding how concurrency work in os
Understanding how concurrency work in os
 

Viewers also liked

Growth of Go - GoSF - Feb. 17, 2016
Growth of Go - GoSF - Feb. 17, 2016Growth of Go - GoSF - Feb. 17, 2016
Growth of Go - GoSF - Feb. 17, 2016
Travis Reeder
 
Go: A Crash Course
Go: A Crash CourseGo: A Crash Course
Go: A Crash Course
Eleanor McHugh
 
Go After 4 Years in Production - QCon 2015
Go After 4 Years in Production - QCon 2015Go After 4 Years in Production - QCon 2015
Go After 4 Years in Production - QCon 2015
Travis Reeder
 
Python Multiprocessing Spoon-fed - Blue Raster Esri Developer Summit 2013 Lig...
Python Multiprocessing Spoon-fed - Blue Raster Esri Developer Summit 2013 Lig...Python Multiprocessing Spoon-fed - Blue Raster Esri Developer Summit 2013 Lig...
Python Multiprocessing Spoon-fed - Blue Raster Esri Developer Summit 2013 Lig...
Blue Raster
 
8A - TORNADO, JET CRASH, WIND STORM - A BUSY YEAR IN EMERGENCY RESPONSE GIS
8A - TORNADO, JET CRASH, WIND STORM - A BUSY YEAR IN EMERGENCY RESPONSE GIS8A - TORNADO, JET CRASH, WIND STORM - A BUSY YEAR IN EMERGENCY RESPONSE GIS
8A - TORNADO, JET CRASH, WIND STORM - A BUSY YEAR IN EMERGENCY RESPONSE GIS
Wisconsin Land Information Association
 
Concurrency in Python
Concurrency in PythonConcurrency in Python
Concurrency in Python
Gavin Roy
 
Multiprocessing with python
Multiprocessing with pythonMultiprocessing with python
Multiprocessing with python
Patrick Vergain
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
Bo-Yi Wu
 

Viewers also liked (8)

Growth of Go - GoSF - Feb. 17, 2016
Growth of Go - GoSF - Feb. 17, 2016Growth of Go - GoSF - Feb. 17, 2016
Growth of Go - GoSF - Feb. 17, 2016
 
Go: A Crash Course
Go: A Crash CourseGo: A Crash Course
Go: A Crash Course
 
Go After 4 Years in Production - QCon 2015
Go After 4 Years in Production - QCon 2015Go After 4 Years in Production - QCon 2015
Go After 4 Years in Production - QCon 2015
 
Python Multiprocessing Spoon-fed - Blue Raster Esri Developer Summit 2013 Lig...
Python Multiprocessing Spoon-fed - Blue Raster Esri Developer Summit 2013 Lig...Python Multiprocessing Spoon-fed - Blue Raster Esri Developer Summit 2013 Lig...
Python Multiprocessing Spoon-fed - Blue Raster Esri Developer Summit 2013 Lig...
 
8A - TORNADO, JET CRASH, WIND STORM - A BUSY YEAR IN EMERGENCY RESPONSE GIS
8A - TORNADO, JET CRASH, WIND STORM - A BUSY YEAR IN EMERGENCY RESPONSE GIS8A - TORNADO, JET CRASH, WIND STORM - A BUSY YEAR IN EMERGENCY RESPONSE GIS
8A - TORNADO, JET CRASH, WIND STORM - A BUSY YEAR IN EMERGENCY RESPONSE GIS
 
Concurrency in Python
Concurrency in PythonConcurrency in Python
Concurrency in Python
 
Multiprocessing with python
Multiprocessing with pythonMultiprocessing with python
Multiprocessing with python
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 

Similar to A gentle intro to Golang and the Go-universe

Beginning development in go
Beginning development in goBeginning development in go
Beginning development in go
Equaleyes Solutions Ltd.
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with go
Vimlesh Sharma
 
Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016
Codemotion
 
Introduction to Programming in Go
Introduction to Programming in GoIntroduction to Programming in Go
Introduction to Programming in Go
Amr Hassan
 
Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction
Ganesh Samarthyam
 
A First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageA First Look at Google's Go Programming Language
A First Look at Google's Go Programming Language
Ganesh Samarthyam
 
Google GO
Google GOGoogle GO
Google GO
Ajay Gahlot
 
The GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersThe GO Language : From Beginners to Gophers
The GO Language : From Beginners to Gophers
Alessandro Sanino
 
Let's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming LanguageLet's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming Language
Ganesh Samarthyam
 
Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language
Ganesh Samarthyam
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
Amal Mohan N
 
Workshop - Golang language
Workshop - Golang languageWorkshop - Golang language
Workshop - Golang language
Vincent Composieux
 
Golang
GolangGolang
Golang
Saray Chak
 
Getting started with Go - Florin Patan - Codemotion Rome 2017
Getting started with Go - Florin Patan - Codemotion Rome 2017Getting started with Go - Florin Patan - Codemotion Rome 2017
Getting started with Go - Florin Patan - Codemotion Rome 2017
Codemotion
 
Developing GNOME Apps in Javascript
Developing GNOME Apps in JavascriptDeveloping GNOME Apps in Javascript
Developing GNOME Apps in Javascript
Felipe Borges
 
Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
Simon Hewitt
 
Cross Platform Objective C Development Using Gn Ustep
Cross Platform Objective C Development Using Gn UstepCross Platform Objective C Development Using Gn Ustep
Cross Platform Objective C Development Using Gn Ustep
wangii
 
Physical Computing Using Go and Arduino
Physical Computing Using Go and ArduinoPhysical Computing Using Go and Arduino
Physical Computing Using Go and Arduino
Justin Grammens
 
Golang introduction
Golang introductionGolang introduction
Golang introduction
DineshDinesh131
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
Diego Freniche Brito
 

Similar to A gentle intro to Golang and the Go-universe (20)

Beginning development in go
Beginning development in goBeginning development in go
Beginning development in go
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with go
 
Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016Getting started with go - Florin Patan - Codemotion Milan 2016
Getting started with go - Florin Patan - Codemotion Milan 2016
 
Introduction to Programming in Go
Introduction to Programming in GoIntroduction to Programming in Go
Introduction to Programming in Go
 
Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction
 
A First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageA First Look at Google's Go Programming Language
A First Look at Google's Go Programming Language
 
Google GO
Google GOGoogle GO
Google GO
 
The GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersThe GO Language : From Beginners to Gophers
The GO Language : From Beginners to Gophers
 
Let's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming LanguageLet's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming Language
 
Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
Workshop - Golang language
Workshop - Golang languageWorkshop - Golang language
Workshop - Golang language
 
Golang
GolangGolang
Golang
 
Getting started with Go - Florin Patan - Codemotion Rome 2017
Getting started with Go - Florin Patan - Codemotion Rome 2017Getting started with Go - Florin Patan - Codemotion Rome 2017
Getting started with Go - Florin Patan - Codemotion Rome 2017
 
Developing GNOME Apps in Javascript
Developing GNOME Apps in JavascriptDeveloping GNOME Apps in Javascript
Developing GNOME Apps in Javascript
 
Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
 
Cross Platform Objective C Development Using Gn Ustep
Cross Platform Objective C Development Using Gn UstepCross Platform Objective C Development Using Gn Ustep
Cross Platform Objective C Development Using Gn Ustep
 
Physical Computing Using Go and Arduino
Physical Computing Using Go and ArduinoPhysical Computing Using Go and Arduino
Physical Computing Using Go and Arduino
 
Golang introduction
Golang introductionGolang introduction
Golang introduction
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 

Recently uploaded

Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussionPro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
Carrer goals.pptx and their importance in real life
Carrer goals.pptx  and their importance in real lifeCarrer goals.pptx  and their importance in real life
Carrer goals.pptx and their importance in real life
artemacademy2
 
Using-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptxUsing-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptx
kainatfatyma9
 
Proposal: The Ark Project and The BEEP Inc
Proposal: The Ark Project and The BEEP IncProposal: The Ark Project and The BEEP Inc
Proposal: The Ark Project and The BEEP Inc
Raheem Muhammad
 
Gamify it until you make it Improving Agile Development and Operations with ...
Gamify it until you make it  Improving Agile Development and Operations with ...Gamify it until you make it  Improving Agile Development and Operations with ...
Gamify it until you make it Improving Agile Development and Operations with ...
Ben Linders
 
Disaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other usesDisaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other uses
RIDHIMAGARG21
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
 
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdfWhy Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Ben Linders
 
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
kekzed
 
IEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdfIEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdf
Claudio Gallicchio
 
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussionArtificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
OECD Directorate for Financial and Enterprise Affairs
 
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
OECD Directorate for Financial and Enterprise Affairs
 
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
SkillCertProExams
 
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
gpww3sf4
 
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
OECD Directorate for Financial and Enterprise Affairs
 
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
OECD Directorate for Financial and Enterprise Affairs
 
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
OECD Directorate for Financial and Enterprise Affairs
 
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdfBRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
Robin Haunschild
 
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussionPro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 

Recently uploaded (20)

Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussionPro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
 
Carrer goals.pptx and their importance in real life
Carrer goals.pptx  and their importance in real lifeCarrer goals.pptx  and their importance in real life
Carrer goals.pptx and their importance in real life
 
Using-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptxUsing-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptx
 
Proposal: The Ark Project and The BEEP Inc
Proposal: The Ark Project and The BEEP IncProposal: The Ark Project and The BEEP Inc
Proposal: The Ark Project and The BEEP Inc
 
Gamify it until you make it Improving Agile Development and Operations with ...
Gamify it until you make it  Improving Agile Development and Operations with ...Gamify it until you make it  Improving Agile Development and Operations with ...
Gamify it until you make it Improving Agile Development and Operations with ...
 
Disaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other usesDisaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other uses
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
 
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdfWhy Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
 
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
 
IEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdfIEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdf
 
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussionArtificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
 
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
 
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
 
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
 
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
 
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
 
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
 
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
 
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdfBRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
 
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussionPro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
 

A gentle intro to Golang and the Go-universe

  • 1. A gentle intro to Golang and the Go-universe Alex-P. Natsios GoCode.Thessaly(7) 28 feb 2014 Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 2. The Language Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 3. A few words about GO Go, also called golang, was initially developed at google in 2007 and announced in 2009 but most of its popularity boost (and hype) came much later with its first stable release (1.0) on 28 Mar 2012. Characteristics: Compiled Statically typed and garbage collected Object Oriented (but not in the usual way) Sane Concurrency Fast Compilers Rich Standard Library Scalable Tools Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 4. The Gopher! Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 5. The Classic Example package main import "fmt" func main() { fmt.Println("Hello, World!") } Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 6. Packages Go code lives in packages. A package consists of one or more source(.go) files. Typically all files belonging to a package are placed in the same directory. Visibility is determined by case: Foo is exported, foo is not. Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 7. Declarations import “fmt” const answer = 42 var something [10]byte var names = []string {“Alex”, “George”, “Maria” } Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 8. Types All basic types you would expect to have. But string is a basic type. No pointer arithmetic. New (or not exactly that new) types: Slices: Much like many other modern languages, []int Maps: Because suddenly everybody needs them, map[string]int Interfaces: for Polymorphism, interface{} Channels: Used to communicate with goroutines, chan int Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 9. Scope Universe Package File (for imports) Function Block Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 10. Concurrency Concurrency is a property of systems in which several computations are executing simultaneously and potentialy interacting with each other. WARNING: Concurrency is NOT parallelism, although it enables parallelism if you have a multiprocessor system. Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 11. Goroutines Independently executing functions, launched by a go statement. NOT threads. VERY cheap, you might have thousands of goroutines running under the same thread. Have their own dynamic call stack (growning and shrinking as needed). Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 12. Channels A channel provides a connection between goroutines, allowing communication. Channels can be unbuffered or buffered, so they both communicate and synchronize. Buffered channels are asynchronous. Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 13. Channels Code Example package main import "fmt" func main() { greetings := make(chan string, 2) go func() { greetings <- "Hello" greetings <- "World!" }() greet1 := <-greetings greet2 := <-greetings fmt.Println(greet1, greet2) } Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 14. Channels cont. When in main(), “<-greetings” is executed it waits for a value to be sent. Same goes for our anonymous function that expects a reciever to be in place in order for the greetings to be sent. If no sender/receiver is ready (they both must be) then we wait until they are! Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 15. The Toolchain Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 16. The go tool go build - To compile the package. go get - To resolve and install deps. go test - To run the test suite and benchmarks. go install - To install the package. go doc - To generate documentation. go fmt - To properly format your code. go run - To build and run the app. go tool - To run extra tools. and more (properly “integrated” in the go tool) Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 17. Building and workspaces A GO program can be compiled and linked without additional build info. A single tool can compile either individual files or entire systems. In order to work without build scripts a certain directory structure MUST be followed. workspace workspace/ bin/ pkg/ src/ Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 18. workspaces cont. Creating a workspace: mkdir -p $HOME/GoCode/{bin, pkg, src} Telling go about it: export GOPATH=“$HOME/GoCode” export PATH=“$PATH:$GOPATH/bin” Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 19. Links Golang homepage: golang.org Go tour: tour.golang.org Package Doc: golang.org/pkg A little outdated but still useful page: go-lang.cat-v.org Obligatory subreddit: reddit.com/r/golang/ Alex-P. Natsios A gentle intro to Golang and the Go-universe
  • 20. Thank you for your attention! Alex-P. Natsios drakevr@2f30.org http://drakevr.gr http://www.linkedin.com/in/drakevr http://www.github.com/drakevr http://www.facebook.com/drakevr http://www.twitter.com/drakevr Alex-P. Natsios A gentle intro to Golang and the Go-universe