SlideShare a Scribd company logo
Introduction to Go Language 
GDGDEVFESTBAGUIO -CAR 2014 
UNIVERSITY OF BAGUIO 
TZAR C. UMANG 
ICT DIRECTOR –HIVE INC.
Flow of discussion 
Requirements 
Introduction 
Basics 
Sample Deployment
Requirements 
Development 
Software Development Kit and Test Environment 
You can use Appengine’sGo SDK: https://cloud.google.com/appengine/downloads 
Python 2.7 (please don’t use the newest version) 
IDE 
You can use Sublimetxtand notepad++ 
If your on the cloud you can use Github’sonline IDE 
Pushing files when Deploying 
Git: http://git-scm.com
Requirements 
Development Servers 
Highly recommend Google’s Appenginefor Go Language 
You can also use Openshift’sGo Language Environment, but you will not have access to Appengine’sfunctionalities 
Deployment 
You can use Appengine+ Cloudcomputeof Google 
Or OpenshiftBig Gear
Young Language 
Created by: Robert Griesemer, Ken Thompson, and Rob Pike (Googlers) in late 2007 
Brought to public in 2009 
A new systems programming languagefor the past 10 years + 
It is fastto develop, compileand run 
Answer to hardware’s limitations today, yet future proofing your system, where the language handles routine and memory management 
Funand Easymaking developmentmore productiveand we don’t use semicolons “;” 
Uses goroutines, a lightweight communicating processes and its concurrent, multiplexing of it onto threads is done automatically 
Has a good garbage collection, it is efficient and low in latency
Basics -“Hello World” 
package helloworld 
import ( 
"fmt" 
"net/http" //http handler package 
) 
funcinit() { 
http.HandleFunc("/", handle) 
} 
funchandle(w http.ResponseWriter, r *http.Request) { 
fmt.Fprint(w, "<html><body><b>Hello World</b></body></html>") 
}
Basics 
Comments 
Uses /**/ or // 
// for line by line comment 
/**/ for large chunk disabling of function or a big header credit on your code
Basics 
Formatting 
Indention is just like any other IDE for any PL tab works for them 
gofmthandles alignment on you code 
Parenthesis 
Go uses lesser parenthesis 
Structures like if, for and switch don’t require it 
Operator precedence hierarchy is shorter and clearer 
x<<8 + y<<16 //spaces implies what it means
Basics 
Semicolons “ ; “ 
We don’t usually use it to terminate a line just like python 
Mostly used to separate clauses of for –loops and the like 
Making codes cleaner on the eye
Basics 
If –statement 
It looks as simple as this 
if a > 1 { 
return b 
} 
It also accept initialization statements, to setup a local variable 
if err := datastore.Get(c, key, &b); err != nil { 
return err 
}
Basics 
Loop 
Unified for and while, there is no do-while 
For 
for init; condition; post { } 
While 
for condition { } 
For(;;) 
for { } 
No comma operator and “+ +” and “--” are statements not expression 
//Reversea 
fori,j:=0,len(a)1;i<j;i,j=i+1,j1{ 
a[i],a[j]=a[j],a[i] 
} 
To run multiple variables you need to use assignments
Basics 
Switch 
Go uses a more general implementation of switches 
Expressions don’t need to be constants or even integers 
Cases are evaluated top to bottom until a match is found 
And if switch has no statement it switches to “true” 
Making it possible to write if-else-if-else-if-else chain as a switch
Basics 
Switch 
funcunhex(cbyte)byte{ 
switch{ 
case'0'<=c&&c<='9': 
returnc'0' 
case'a'<=c&&c<='f': 
returnc'a'+10 
case'A'<=c&&c<='F': 
returnc'A'+10 
} 
return0 
}
Basics 
Switch 
Cases can be presented into commas as well 
funcrunOver(cbyte)bool{ 
switchc{ 
case'','?','&','=','#','+','%': 
returntrue 
} 
returnfalse 
}
Basics 
Types 
It uses the regular int, float, string 
Booleans (&& “and”, || “or”, ! “not”) 
Explicitly sized typesthe likes of int8, float64 
Unsigned integers, uint, uint32
Basics 
Strings 
It is built in, these are immutable values not just arrays of bytes values. 
You can’t change a string variable once it is built 
Though you can use snippets to change or to reassign string variables 
s:="hello" 
ifs[1]!='e'{os.Exit(1)} 
s="goodbye" 
varp*string=&s 
*p="ciao"
Basics 
Arrays 
Declared this way 
vararrayOfInt[10]int; 
They are like strings with values though mutable 
Arrays holds values in Go making it as meaningful as a string, not like with other language such as C where arrays are pointers
Basics 
Pointers 
We have them but they are limited 
No pointer arithmetic 
Easier for garbage collection
Basics 
Database supported 
MySQL, Oracle, DB2 
MongoDB, NoSQL 
Mobile App Delivery Supported Platform and Framework (Based on our testing) 
Intel XDK 
Phonegap
Basics 
Libraries 
OS, I/O, files 
math (sin(x) etc.) 
strings, Unicode, regular expressions 
reflection 
command-line flags, logging 
hashes, crypto 
testing (plus testing tool, gotest) 
networking, HTTP, RPC 
HTML (and more general) templates 
And growing… 
Documentation and complete list here: http://golang.org
Other Resources 
http://golang.org/pkg/ (package docs) 
http://golang.org/src/ (source code)
Requirements 
Development 
Software Development Kit 
You can use Appengine’sGo SDK: https://cloud.google.com/appengine/downloads 
Python 2.7 (please don’t use the newest version) 
IDE 
You can use Sublimetxtand notepad++ 
If your on the cloud you can use Github’sonline IDE 
Pushing files 
Git: http://git-scm.com
Requirements 
Development Servers 
Highly recommend Google’s Appenginefor Go Language 
You can also Openshift’sGo Language Environment, but you will not have access to Appengine’sfunctionalities 
Deployment 
You can use Appengine+ Cloudcomputeof Google 
Or OpenshiftBig Gear
THANK YOU!!! 
For Questions and Tutorials you may join the group 
“Philippine Gophers” in FB and G+ 
Or add me in: 
fb.com/tzarumang 
twitter.com/definitelytzar 
plus.google.com/tzarumang 
Presentation is based from: 
golang.org 
Chris Lupo’sThe Go Programming Language

More Related Content

PDF
Go language presentation
PDF
The Go programming language - Intro by MyLittleAdventure
PPTX
Go Programming language, golang
PPTX
Go Programming Language (Golang)
PDF
Golang 101
PPTX
Golang (Go Programming Language)
PPT
GO programming language
Go language presentation
The Go programming language - Intro by MyLittleAdventure
Go Programming language, golang
Go Programming Language (Golang)
Golang 101
Golang (Go Programming Language)
GO programming language

What's hot (20)

PPTX
Introduction to go lang
PDF
Introduction to Go programming language
PPTX
Go. Why it goes
PDF
Golang
PDF
Golang and Eco-System Introduction / Overview
PDF
Coding with golang
PDF
Introduction to go language programming
PDF
GoLang Introduction
PDF
PDF
Go Programming Language by Google
PPTX
Go Language presentation
PPTX
Golang - Overview of Go (golang) Language
PPTX
Why TypeScript?
PDF
Concurrency in Golang
PDF
Go Lang Tutorial
PPTX
Introduction to GoLang
PDF
Goroutines and Channels in practice
PDF
TypeScript - An Introduction
PDF
RxJS Operators - Real World Use Cases - AngularMix
PDF
TypeScript
Introduction to go lang
Introduction to Go programming language
Go. Why it goes
Golang
Golang and Eco-System Introduction / Overview
Coding with golang
Introduction to go language programming
GoLang Introduction
Go Programming Language by Google
Go Language presentation
Golang - Overview of Go (golang) Language
Why TypeScript?
Concurrency in Golang
Go Lang Tutorial
Introduction to GoLang
Goroutines and Channels in practice
TypeScript - An Introduction
RxJS Operators - Real World Use Cases - AngularMix
TypeScript
Ad

Viewers also liked (20)

PPTX
Software engineer
PPTX
Learning Analytics - What Do Stakeholders Really Think?
PDF
Life Sciences: Career Development in Europe and Asia
PPTX
Agile cost estimation
PDF
Agile Methodologies and Cost Estimation
PDF
bti asia salary guide
PDF
Sharing up to 80% code for iOS, Android, and Windows platforms, a Retail App ...
PDF
Southeast Indonesia: A guide for investors and developers in Lombok, Sumbawa,...
PPTX
GO Mobile presentation for English Language Centre at the University of Liver...
PPT
Developing a technology enhanced learning strategy
PDF
Natural Resources: Career Development in Europe and Asia
PDF
Estimation or, "How to Dig your Grave"
PDF
Project-Based Instruction and the Importance of Self-Directed Learning
PPTX
Open Minded? Software Engineer to a UX Engineer. Ask me how. by Micael Diaz d...
PPT
#CodingL1: Coding as a (second) mother language
PDF
Spark Streaming Tips for Devs and Ops by Fran perez y federico fernández
PDF
Code Drives the World
PPTX
Coding as a (second) Language
PDF
Creating a Culture of Learning in the New Year
PDF
2017 - Salary Guide
Software engineer
Learning Analytics - What Do Stakeholders Really Think?
Life Sciences: Career Development in Europe and Asia
Agile cost estimation
Agile Methodologies and Cost Estimation
bti asia salary guide
Sharing up to 80% code for iOS, Android, and Windows platforms, a Retail App ...
Southeast Indonesia: A guide for investors and developers in Lombok, Sumbawa,...
GO Mobile presentation for English Language Centre at the University of Liver...
Developing a technology enhanced learning strategy
Natural Resources: Career Development in Europe and Asia
Estimation or, "How to Dig your Grave"
Project-Based Instruction and the Importance of Self-Directed Learning
Open Minded? Software Engineer to a UX Engineer. Ask me how. by Micael Diaz d...
#CodingL1: Coding as a (second) mother language
Spark Streaming Tips for Devs and Ops by Fran perez y federico fernández
Code Drives the World
Coding as a (second) Language
Creating a Culture of Learning in the New Year
2017 - Salary Guide
Ad

Similar to Introduction to Go language (20)

PPT
Introduction to Go ProgrammingLanguage.ppt
PDF
Golang workshop
PDF
The GO programming language
PPTX
Go Language Hands-on Workshop Material
PDF
Introduction to Go
PPTX
Go fundamentals
PPTX
The GO Language : From Beginners to Gophers
PPTX
Golang 101 (Concurrency vs Parallelism)
PDF
Introduction to Programming in Go
PDF
Beginning development in go
PDF
10 reasons to be excited about go
PDF
Go Programming by Example_ Nho Vĩnh Share.pdf
PDF
Learning Go Programming 1st Edition Vladimir Vivien all chapter instant download
PDF
Happy Go Programming Part 1
PDF
Go for SysAdmins - LISA 2015
PDF
Let's Go-lang
PPTX
Golang introduction
PDF
Coding in GO - GDG SL - NSBM
PPTX
Google GO
PPTX
Golang workshop - Mindbowser
Introduction to Go ProgrammingLanguage.ppt
Golang workshop
The GO programming language
Go Language Hands-on Workshop Material
Introduction to Go
Go fundamentals
The GO Language : From Beginners to Gophers
Golang 101 (Concurrency vs Parallelism)
Introduction to Programming in Go
Beginning development in go
10 reasons to be excited about go
Go Programming by Example_ Nho Vĩnh Share.pdf
Learning Go Programming 1st Edition Vladimir Vivien all chapter instant download
Happy Go Programming Part 1
Go for SysAdmins - LISA 2015
Let's Go-lang
Golang introduction
Coding in GO - GDG SL - NSBM
Google GO
Golang workshop - Mindbowser

More from Tzar Umang (15)

PDF
Tzar-Resume-2018.pdf
PPTX
Cloud security From Infrastructure to People-ware
PPTX
Social engineering The Good and Bad
PPTX
A Different Perspective on Business with Social Data
PPTX
Introduction to Tensorflow
PPTX
Kanban
PPTX
Social Media Analytics for the 3rd and Final Presidential Debate
PPTX
From Sensing to Decision
PPTX
Smart Cities
PDF
Smart ICT Lingayen Presentation
PDF
Formal Concept Analysis
PDF
Smart ICT extended
PPT
Cloud computing Disambiguation using Kite Model
PPTX
Scrum
PPTX
Business intelligence for SMEs with Data Analytics
Tzar-Resume-2018.pdf
Cloud security From Infrastructure to People-ware
Social engineering The Good and Bad
A Different Perspective on Business with Social Data
Introduction to Tensorflow
Kanban
Social Media Analytics for the 3rd and Final Presidential Debate
From Sensing to Decision
Smart Cities
Smart ICT Lingayen Presentation
Formal Concept Analysis
Smart ICT extended
Cloud computing Disambiguation using Kite Model
Scrum
Business intelligence for SMEs with Data Analytics

Recently uploaded (20)

DOCX
Unit-3 cyber security network security of internet system
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PPTX
Database Information System - Management Information System
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPT
250152213-Excitation-SystemWERRT (1).ppt
PDF
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
PDF
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PPTX
Internet___Basics___Styled_ presentation
PDF
Introduction to the IoT system, how the IoT system works
PDF
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
PPTX
SAP Ariba Sourcing PPT for learning material
PDF
Exploring VPS Hosting Trends for SMBs in 2025
PPT
415456121-Jiwratrwecdtwfdsfwgdwedvwe dbwsdjsadca-EVN.ppt
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
Unit-3 cyber security network security of internet system
SASE Traffic Flow - ZTNA Connector-1.pdf
INTERNET------BASICS-------UPDATED PPT PRESENTATION
Design_with_Watersergyerge45hrbgre4top (1).ppt
Power Point - Lesson 3_2.pptx grad school presentation
Database Information System - Management Information System
The New Creative Director: How AI Tools for Social Media Content Creation Are...
250152213-Excitation-SystemWERRT (1).ppt
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)
Module 1 - Cyber Law and Ethics 101.pptx
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
Internet___Basics___Styled_ presentation
Introduction to the IoT system, how the IoT system works
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
SAP Ariba Sourcing PPT for learning material
Exploring VPS Hosting Trends for SMBs in 2025
415456121-Jiwratrwecdtwfdsfwgdwedvwe dbwsdjsadca-EVN.ppt
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)

Introduction to Go language

  • 1. Introduction to Go Language GDGDEVFESTBAGUIO -CAR 2014 UNIVERSITY OF BAGUIO TZAR C. UMANG ICT DIRECTOR –HIVE INC.
  • 2. Flow of discussion Requirements Introduction Basics Sample Deployment
  • 3. Requirements Development Software Development Kit and Test Environment You can use Appengine’sGo SDK: https://cloud.google.com/appengine/downloads Python 2.7 (please don’t use the newest version) IDE You can use Sublimetxtand notepad++ If your on the cloud you can use Github’sonline IDE Pushing files when Deploying Git: http://git-scm.com
  • 4. Requirements Development Servers Highly recommend Google’s Appenginefor Go Language You can also use Openshift’sGo Language Environment, but you will not have access to Appengine’sfunctionalities Deployment You can use Appengine+ Cloudcomputeof Google Or OpenshiftBig Gear
  • 5. Young Language Created by: Robert Griesemer, Ken Thompson, and Rob Pike (Googlers) in late 2007 Brought to public in 2009 A new systems programming languagefor the past 10 years + It is fastto develop, compileand run Answer to hardware’s limitations today, yet future proofing your system, where the language handles routine and memory management Funand Easymaking developmentmore productiveand we don’t use semicolons “;” Uses goroutines, a lightweight communicating processes and its concurrent, multiplexing of it onto threads is done automatically Has a good garbage collection, it is efficient and low in latency
  • 6. Basics -“Hello World” package helloworld import ( "fmt" "net/http" //http handler package ) funcinit() { http.HandleFunc("/", handle) } funchandle(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "<html><body><b>Hello World</b></body></html>") }
  • 7. Basics Comments Uses /**/ or // // for line by line comment /**/ for large chunk disabling of function or a big header credit on your code
  • 8. Basics Formatting Indention is just like any other IDE for any PL tab works for them gofmthandles alignment on you code Parenthesis Go uses lesser parenthesis Structures like if, for and switch don’t require it Operator precedence hierarchy is shorter and clearer x<<8 + y<<16 //spaces implies what it means
  • 9. Basics Semicolons “ ; “ We don’t usually use it to terminate a line just like python Mostly used to separate clauses of for –loops and the like Making codes cleaner on the eye
  • 10. Basics If –statement It looks as simple as this if a > 1 { return b } It also accept initialization statements, to setup a local variable if err := datastore.Get(c, key, &b); err != nil { return err }
  • 11. Basics Loop Unified for and while, there is no do-while For for init; condition; post { } While for condition { } For(;;) for { } No comma operator and “+ +” and “--” are statements not expression //Reversea fori,j:=0,len(a)1;i<j;i,j=i+1,j1{ a[i],a[j]=a[j],a[i] } To run multiple variables you need to use assignments
  • 12. Basics Switch Go uses a more general implementation of switches Expressions don’t need to be constants or even integers Cases are evaluated top to bottom until a match is found And if switch has no statement it switches to “true” Making it possible to write if-else-if-else-if-else chain as a switch
  • 13. Basics Switch funcunhex(cbyte)byte{ switch{ case'0'<=c&&c<='9': returnc'0' case'a'<=c&&c<='f': returnc'a'+10 case'A'<=c&&c<='F': returnc'A'+10 } return0 }
  • 14. Basics Switch Cases can be presented into commas as well funcrunOver(cbyte)bool{ switchc{ case'','?','&','=','#','+','%': returntrue } returnfalse }
  • 15. Basics Types It uses the regular int, float, string Booleans (&& “and”, || “or”, ! “not”) Explicitly sized typesthe likes of int8, float64 Unsigned integers, uint, uint32
  • 16. Basics Strings It is built in, these are immutable values not just arrays of bytes values. You can’t change a string variable once it is built Though you can use snippets to change or to reassign string variables s:="hello" ifs[1]!='e'{os.Exit(1)} s="goodbye" varp*string=&s *p="ciao"
  • 17. Basics Arrays Declared this way vararrayOfInt[10]int; They are like strings with values though mutable Arrays holds values in Go making it as meaningful as a string, not like with other language such as C where arrays are pointers
  • 18. Basics Pointers We have them but they are limited No pointer arithmetic Easier for garbage collection
  • 19. Basics Database supported MySQL, Oracle, DB2 MongoDB, NoSQL Mobile App Delivery Supported Platform and Framework (Based on our testing) Intel XDK Phonegap
  • 20. Basics Libraries OS, I/O, files math (sin(x) etc.) strings, Unicode, regular expressions reflection command-line flags, logging hashes, crypto testing (plus testing tool, gotest) networking, HTTP, RPC HTML (and more general) templates And growing… Documentation and complete list here: http://golang.org
  • 21. Other Resources http://golang.org/pkg/ (package docs) http://golang.org/src/ (source code)
  • 22. Requirements Development Software Development Kit You can use Appengine’sGo SDK: https://cloud.google.com/appengine/downloads Python 2.7 (please don’t use the newest version) IDE You can use Sublimetxtand notepad++ If your on the cloud you can use Github’sonline IDE Pushing files Git: http://git-scm.com
  • 23. Requirements Development Servers Highly recommend Google’s Appenginefor Go Language You can also Openshift’sGo Language Environment, but you will not have access to Appengine’sfunctionalities Deployment You can use Appengine+ Cloudcomputeof Google Or OpenshiftBig Gear
  • 24. THANK YOU!!! For Questions and Tutorials you may join the group “Philippine Gophers” in FB and G+ Or add me in: fb.com/tzarumang twitter.com/definitelytzar plus.google.com/tzarumang Presentation is based from: golang.org Chris Lupo’sThe Go Programming Language