SlideShare a Scribd company logo
1 of 37
The Go Programming Language
Seminar Guide:
Ms. Alby S.
Assistant Professor
Dept. Computer Applications
Presented by:
Basil N G
Roll No:17
MCA S5 R
Go is a programming language
designed by Google to help
solve Google's problems.
What is Go?
And has big
problems!
Which (big) problems?
● Hardware is big and the software is big
● There are many millions of lines of software
● Servers mostly in C++ and lots of Java and Python
● Thousands of engineers work on the code
● And of course, all this software runs on zillions of
machines.
A lot of others people
help to bring go from
prototype to reality.
Go became a public
Open Source
project.
2008 2009 20102007
Starts to have
adoption by other
programmers
Started and built by
Robert Griesemer,
Rob Pike and Ken
Thompson as a
part-time project.
History
● Ken Thompson (B, C, Unix, UTF-8)
● Rob Pike (Unix, UTF-8)
● Robert Griesemer (Hotspot, JVM)
...and a few others engineers at Google
Who were the founders?
● Eliminate slowness
● Eliminate clumsiness
● Improve productive
● Maintain (and improve) scale
It was designed by and for people who write, read,
debug and maintain large software systems.
Go's purpose is not to do research programming
language design.
Go's purpose is to make its designers' programming
lives better.
Why Go?
Go is a compiled, concurrent,
garbage-collected, statically typed
language developed at .
What is Go?
build
run
clean
env
test
compile packages and dependencies
compile and run Go program
remove object files
print Go environment information
test packages and benchmarks
Go is a tool for managing Go source code...
Mainly tools:
Others tools:
fix, fmt, get, install, list, tool,
version, vet.
Who are using today?
https://github.com/golang/go/wiki/GoUsers
❏ Compiled
❏ Garbage-collected
❏ Has your own runtime
❏ Simple syntax
❏ Great standard library
❏ Cross-platform
❏ Object Oriented (without inheritance)
❏ Statically and stronger typed
❏ Concurrent (goroutines)
❏ Closures
❏ Explicity dependencies
❏ Multiple return values
❏ Pointers
❏ and so on...
What will you see in Go?
Have not been implemented in
favor of efficiency.
❏ Exception handling
❏ Inheritance
❏ Generics
❏ Assert
❏ Method overload
What will you not
see in Go?
see a bit of code!
A Go program basically consists of
the following parts :−
Package Declaration
Import Packages
Functions
Variables
Statements and Expressions
Comments
Sample Program
package main
import "fmt“
func main() {
/* This is my first sample program. */
fmt.Println("Hello, World!")
}
Go - Data Types
Boolean types
They are Boolean types and consists of the two predefined
constants: (a) true (b) false
Eg: var abc bool = true
Numeric types
They are arithmetic types and they represents
a) integer types (uint8-uint64, int8-int64, byte, rune, uint, int
b) floating point values (float32-float64)
(complex64-complex128)
Eg: var num int32 = -123
Contd…
String types
A string type represents the set of string values.
Its value is a sequence of bytes.
Eg: var str string =“hello”
Derived types
They include (a) Pointer types, (b) Array types, (c) Structure types,
(d) Union types (e) Function types f) Slice types g) Function types
h) Interface types i) Map types j) Channel Types
Go - Operators
Arithmetic Operators
Relational Operators
Logical Operators
Bitwise Operators
Assignment Operators
Miscellaneous Operators
Operator Meaning
= = equal to
!= Not Equal to
< Less than
> Greater than
<= Less than or
equal to
>= Greater than or
equal to
Operator Meaning
+ add
- Subtraction
* Multiplication
/ Division
% modulus
++ Increment
-- Decrement
1. Arithmetic Operators 2.Relational Operators
Operator Meaning
&& Logical AND
| | Logical OR
! Logical NOT
Operator Meaning
& Logical AND
| Logical OR
^ Logical NOT
<< Binary Left Shift
>> Binary Right Shift
3.Logical operators 4.Bitwise operators
5.Miscellaneous Operators
Operator Meaning
& Returns the address of a variable
* Pointer to a variable
Go – Decision Making
if statement
Consists of a boolean expression followed by one or more
statements.
package main
import "fmt“
func main() {
if n:=8; n%4 == 0 {
fmt.Println("8 is divisible by 4")
}
}
There is also if... else and nested if statements
switch statement
A switch statement allows a variable to be tested
for equality against a list of values.
os := "wndows"
switch os {
case "darwin":
fmt.Println("OS X.")
case "linux":
fmt.Println("Linux.")
default:
fmt.Printf("%s.", os)
}
Contd…
Go- Loops
For Loop
It executes a sequence of statements multiple times and
abbreviates the code that manages the loop variable.
• Go has just for as looping structure
• It is very similar with C or Java code, except for ( )
• Start and end declarations can be empty
Eg: for i:=0;i<5;i++ {
fmt.Printf("%d",i)
if i==3 {
fmt.Println("bye")
break
}
}
For is Go's "while“
At that point you can drop the semicolons: C's while is
spelled for in Go.
Eg: sum := 1
for sum <= 10 {
sum += sum
}
fmt.Println(sum)
Forever
If you omit the loop condition it loops forever, so an infinite
loop is compactly expressed.
Eg: for{
}
The deferred call's arguments are evaluated immediately, but the
function call is not executed until the surrounding function
returns.
func main() {
defer fmt.Println("world")
fmt.Println("hello")
}
Defer
Go - Functions
func function_name( [parameter list] ) [return_types] {
body of the function
}
• A function declaration binds an identifier,
the function name, to a function.
• Multiple return values
• Named result parameters
Go – Multiple Return Values
func swap(x, y string) (string, string) {
return y, x
}
func main() {
a, b := swap("hello", "world")
fmt.Println(a, b)
}
One of Go's unusual features is that functions and
methods can return multiple values.
What more?
● Pointer
● Struct
● Matrix
● Slice
● Range
● Closure //func inside a func
● Map
● Value function
● Method
● Interface
● Stringer
● Error
● and a lot of more!!!
$ go run http.go
A web server
● It is just simple to build a web server with 15 lines or less!!
Could you belive that???
● To execute a goroutine, just go!
● To send or receive information between the
goroutines, use channels
● Use the GOMAXPROCS environment variable to
define the amount of threads
Concurrency (goroutines)
$ go run goroutines.go
hello
world
hello
world
hello
world
hello
world
hello
● A goroutine is a lightweight thread managed by Go runtime
Goroutines
$ go run channels.go
17 -5 12
Channels
● Channels are typed's conduit through which you can send and receive
values with the channel operator <-
Unbuffered Channels
c := make (chan int)
Buffered Channels
c := make (chan int, 10)
Conclusion
•In 2014, analyst Donnie Berkholz called Go the emerging language of
cloud infrastructure. By 2017, Go has emerged as the language of
cloud infrastructure. Today, every single cloud company has
critical components of their cloud infrastructure implemented in
Go including Google Cloud, AWS, Microsoft Azure and many more
•In Stack Overflow's 2017 developer survey , Go was the only
language that was both on the top 5 most loved and top 5 most
wanted languages. People who use Go, love it, and the people who
aren’t using Go, want to be.
References
Go websites:
Official:
https://golang.org/
Documents:
http://golang.org/doc/effective_go.html
https://blog.golang.org/
Video & Programs:
http://www.newthinktank.com/2015/02/go-
programming-tutorial/
Questions?
Thanks

More Related Content

What's hot

Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by GoogleUttam Gandhi
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageAniruddha Chakrabarti
 
Golang 101
Golang 101Golang 101
Golang 101宇 傅
 
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programmingMahmoud Masih Tehrani
 
Introduction to GoLang
Introduction to GoLangIntroduction to GoLang
Introduction to GoLangNVISIA
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)ShubhamMishra485
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)Ishin Vin
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewMarkus Schneider
 
Go vs Python Comparison
Go vs Python ComparisonGo vs Python Comparison
Go vs Python ComparisonSimplilearn
 
Goroutines and Channels in practice
Goroutines and Channels in practiceGoroutines and Channels in practice
Goroutines and Channels in practiceGuilherme Garnier
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go languageTzar Umang
 
Rust Programming Language
Rust Programming LanguageRust Programming Language
Rust Programming LanguageJaeju Kim
 

What's hot (20)

Golang
GolangGolang
Golang
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
Golang 101
Golang 101Golang 101
Golang 101
 
Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
 
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
 
Introduction to GoLang
Introduction to GoLangIntroduction to GoLang
Introduction to GoLang
 
Go lang
Go langGo lang
Go lang
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)
 
Go Lang Tutorial
Go Lang TutorialGo Lang Tutorial
Go Lang Tutorial
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)
 
GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / Overview
 
Golang Template
Golang TemplateGolang Template
Golang Template
 
Go vs Python Comparison
Go vs Python ComparisonGo vs Python Comparison
Go vs Python Comparison
 
Goroutines and Channels in practice
Goroutines and Channels in practiceGoroutines and Channels in practice
Goroutines and Channels in practice
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
 
An introduction to programming in Go
An introduction to programming in GoAn introduction to programming in Go
An introduction to programming in Go
 
Golang workshop
Golang workshopGolang workshop
Golang workshop
 
Rust Programming Language
Rust Programming LanguageRust Programming Language
Rust Programming Language
 

Similar to The Go Programming Language Seminar Guide

go language- haseeb.pptx
go language- haseeb.pptxgo language- haseeb.pptx
go language- haseeb.pptxArsalanMaqsood1
 
The GO programming language
The GO programming languageThe GO programming language
The GO programming languageMarco Sabatini
 
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io
 
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 goDvir Volk
 
Go programming introduction
Go programming introductionGo programming introduction
Go programming introductionGinto Joseph
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Rasan Samarasinghe
 
Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoRodolfo Carvalho
 
Go from a PHP Perspective
Go from a PHP PerspectiveGo from a PHP Perspective
Go from a PHP PerspectiveBarry Jones
 
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 GophersAlessandro Sanino
 
Introduction to Go for Java Developers
Introduction to Go for Java DevelopersIntroduction to Go for Java Developers
Introduction to Go for Java DevelopersLaszlo Csontos
 
Come With Golang
Come With GolangCome With Golang
Come With Golang尚文 曾
 

Similar to The Go Programming Language Seminar Guide (20)

go language- haseeb.pptx
go language- haseeb.pptxgo language- haseeb.pptx
go language- haseeb.pptx
 
The GO programming language
The GO programming languageThe GO programming language
The GO programming language
 
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and Golang
 
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
 
Should i Go there
Should i Go thereShould i Go there
Should i Go there
 
Go. why it goes v2
Go. why it goes v2Go. why it goes v2
Go. why it goes v2
 
Golang online course
Golang online courseGolang online course
Golang online course
 
Go programming introduction
Go programming introductionGo programming introduction
Go programming introduction
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++
 
Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX Go
 
Go from a PHP Perspective
Go from a PHP PerspectiveGo from a PHP Perspective
Go from a PHP Perspective
 
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
 
Introduction to Go for Java Developers
Introduction to Go for Java DevelopersIntroduction to Go for Java Developers
Introduction to Go for Java Developers
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Come With Golang
Come With GolangCome With Golang
Come With Golang
 
Go fundamentals
Go fundamentalsGo fundamentals
Go fundamentals
 
Golang preso
Golang presoGolang preso
Golang preso
 
Golang
GolangGolang
Golang
 
Go_ Get iT! .pdf
Go_ Get iT! .pdfGo_ Get iT! .pdf
Go_ Get iT! .pdf
 
2CPP02 - C++ Primer
2CPP02 - C++ Primer2CPP02 - C++ Primer
2CPP02 - C++ Primer
 

Recently uploaded

chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 

Recently uploaded (20)

chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 

The Go Programming Language Seminar Guide

  • 1. The Go Programming Language Seminar Guide: Ms. Alby S. Assistant Professor Dept. Computer Applications Presented by: Basil N G Roll No:17 MCA S5 R
  • 2. Go is a programming language designed by Google to help solve Google's problems. What is Go? And has big problems!
  • 3. Which (big) problems? ● Hardware is big and the software is big ● There are many millions of lines of software ● Servers mostly in C++ and lots of Java and Python ● Thousands of engineers work on the code ● And of course, all this software runs on zillions of machines.
  • 4. A lot of others people help to bring go from prototype to reality. Go became a public Open Source project. 2008 2009 20102007 Starts to have adoption by other programmers Started and built by Robert Griesemer, Rob Pike and Ken Thompson as a part-time project. History
  • 5. ● Ken Thompson (B, C, Unix, UTF-8) ● Rob Pike (Unix, UTF-8) ● Robert Griesemer (Hotspot, JVM) ...and a few others engineers at Google Who were the founders?
  • 6. ● Eliminate slowness ● Eliminate clumsiness ● Improve productive ● Maintain (and improve) scale It was designed by and for people who write, read, debug and maintain large software systems. Go's purpose is not to do research programming language design. Go's purpose is to make its designers' programming lives better. Why Go?
  • 7. Go is a compiled, concurrent, garbage-collected, statically typed language developed at . What is Go?
  • 8. build run clean env test compile packages and dependencies compile and run Go program remove object files print Go environment information test packages and benchmarks Go is a tool for managing Go source code... Mainly tools: Others tools: fix, fmt, get, install, list, tool, version, vet.
  • 9. Who are using today? https://github.com/golang/go/wiki/GoUsers
  • 10. ❏ Compiled ❏ Garbage-collected ❏ Has your own runtime ❏ Simple syntax ❏ Great standard library ❏ Cross-platform ❏ Object Oriented (without inheritance) ❏ Statically and stronger typed ❏ Concurrent (goroutines) ❏ Closures ❏ Explicity dependencies ❏ Multiple return values ❏ Pointers ❏ and so on... What will you see in Go?
  • 11. Have not been implemented in favor of efficiency. ❏ Exception handling ❏ Inheritance ❏ Generics ❏ Assert ❏ Method overload What will you not see in Go?
  • 12. see a bit of code!
  • 13. A Go program basically consists of the following parts :− Package Declaration Import Packages Functions Variables Statements and Expressions Comments
  • 14. Sample Program package main import "fmt“ func main() { /* This is my first sample program. */ fmt.Println("Hello, World!") }
  • 15. Go - Data Types Boolean types They are Boolean types and consists of the two predefined constants: (a) true (b) false Eg: var abc bool = true Numeric types They are arithmetic types and they represents a) integer types (uint8-uint64, int8-int64, byte, rune, uint, int b) floating point values (float32-float64) (complex64-complex128) Eg: var num int32 = -123
  • 16. Contd… String types A string type represents the set of string values. Its value is a sequence of bytes. Eg: var str string =“hello” Derived types They include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types (e) Function types f) Slice types g) Function types h) Interface types i) Map types j) Channel Types
  • 17. Go - Operators Arithmetic Operators Relational Operators Logical Operators Bitwise Operators Assignment Operators Miscellaneous Operators
  • 18. Operator Meaning = = equal to != Not Equal to < Less than > Greater than <= Less than or equal to >= Greater than or equal to Operator Meaning + add - Subtraction * Multiplication / Division % modulus ++ Increment -- Decrement 1. Arithmetic Operators 2.Relational Operators
  • 19. Operator Meaning && Logical AND | | Logical OR ! Logical NOT Operator Meaning & Logical AND | Logical OR ^ Logical NOT << Binary Left Shift >> Binary Right Shift 3.Logical operators 4.Bitwise operators 5.Miscellaneous Operators Operator Meaning & Returns the address of a variable * Pointer to a variable
  • 20. Go – Decision Making if statement Consists of a boolean expression followed by one or more statements. package main import "fmt“ func main() { if n:=8; n%4 == 0 { fmt.Println("8 is divisible by 4") } } There is also if... else and nested if statements
  • 21. switch statement A switch statement allows a variable to be tested for equality against a list of values. os := "wndows" switch os { case "darwin": fmt.Println("OS X.") case "linux": fmt.Println("Linux.") default: fmt.Printf("%s.", os) } Contd…
  • 22. Go- Loops For Loop It executes a sequence of statements multiple times and abbreviates the code that manages the loop variable. • Go has just for as looping structure • It is very similar with C or Java code, except for ( ) • Start and end declarations can be empty Eg: for i:=0;i<5;i++ { fmt.Printf("%d",i) if i==3 { fmt.Println("bye") break } }
  • 23. For is Go's "while“ At that point you can drop the semicolons: C's while is spelled for in Go. Eg: sum := 1 for sum <= 10 { sum += sum } fmt.Println(sum) Forever If you omit the loop condition it loops forever, so an infinite loop is compactly expressed. Eg: for{ }
  • 24. The deferred call's arguments are evaluated immediately, but the function call is not executed until the surrounding function returns. func main() { defer fmt.Println("world") fmt.Println("hello") } Defer
  • 25. Go - Functions func function_name( [parameter list] ) [return_types] { body of the function } • A function declaration binds an identifier, the function name, to a function. • Multiple return values • Named result parameters
  • 26. Go – Multiple Return Values func swap(x, y string) (string, string) { return y, x } func main() { a, b := swap("hello", "world") fmt.Println(a, b) } One of Go's unusual features is that functions and methods can return multiple values.
  • 27. What more? ● Pointer ● Struct ● Matrix ● Slice ● Range ● Closure //func inside a func ● Map ● Value function ● Method ● Interface ● Stringer ● Error ● and a lot of more!!!
  • 28. $ go run http.go A web server ● It is just simple to build a web server with 15 lines or less!! Could you belive that???
  • 29. ● To execute a goroutine, just go! ● To send or receive information between the goroutines, use channels ● Use the GOMAXPROCS environment variable to define the amount of threads Concurrency (goroutines)
  • 30. $ go run goroutines.go hello world hello world hello world hello world hello ● A goroutine is a lightweight thread managed by Go runtime Goroutines
  • 31. $ go run channels.go 17 -5 12 Channels ● Channels are typed's conduit through which you can send and receive values with the channel operator <-
  • 32. Unbuffered Channels c := make (chan int)
  • 33. Buffered Channels c := make (chan int, 10)
  • 34. Conclusion •In 2014, analyst Donnie Berkholz called Go the emerging language of cloud infrastructure. By 2017, Go has emerged as the language of cloud infrastructure. Today, every single cloud company has critical components of their cloud infrastructure implemented in Go including Google Cloud, AWS, Microsoft Azure and many more •In Stack Overflow's 2017 developer survey , Go was the only language that was both on the top 5 most loved and top 5 most wanted languages. People who use Go, love it, and the people who aren’t using Go, want to be.