SlideShare a Scribd company logo
Introduction to GoLang
BY AMAL MOHAN N
Discussion Points
● History of Go.
● What is Go?
● What you’ll see in Go.
● What will you not see in Go.
● Why Go?
● Features
● Important Points.
● Who all are using Go
● Go installation
● Go Tools.
● Go structure.
● Types, Variables and Statements
● FrameWorks.
● Go Scope
● Go Docs
● Drawbacks
Founders of Go.
Ken Thompson Rob Pike Robert Griesemer
Kenneth Lane Thompson is an
American pioneer of computer
science.Thompson worked at Bell
Labs for most of his career where
he designed and implemented the
original Unix operating system.
A Swiss computer scientist. He is best
known for his work on the Go. Prior to
Go, he worked on Google's V8
JavaScript engine, the Sawzall
language, the Java HotSpot virtual
machine, and the Strongtalk system.
Robert "Rob" Pike is a Canadian
programmer and author. He is best
known for his work on the Go
programming language and at Bell
Labs, where he was a member of
the Unix team.
History of Go.
2021
1.17
What is Go?
● Go is Open-Source General-Purpose programming language
developed by Google.
● Solution to “BIG PROBLEMS” at Google.
What you’ll see in Go.
● Compiled
● Garbage Collection
● Simple Syntax
● Great standard library
● Cross Platform
● Object Oriented (no Inheritance)
● Statically typed
● Extensive use of pointers
● Extensive use of Structures
● Extensive use of Interfaces
● Extensive use of If statements
● Extensive use of for loops
● Multiple returns
What will you not see in Go.
● Exception Handling
● Inheritance
● Generics
● Assert
● Method Overloading
● Some loops
● Ternary Operator
Why Go?
● Simplicity
● Eliminates Slowness ( Performance ).
● Secure and Easy to Maintain code.
● Concurrency
● Good Hardware Interaction.
● Speed for Production.
● Easy read, write, debug, and Maintain Large Software Systems (Google).
● Community
For Starters
Why Go?
● Why Go was developed when there already was many popular languages?
Go was invented (in 2007) at a time when multicore CPU architectures were common.With multiple
cores, code can run in parallel on all available cores; but there was no programming language that
simplified the development of multithreaded applications. The responsibility of managing different threads
safely and efficiently fell on developers. Thread-locking, race conditions and deadlocks are usual
challenges. Go was designed with concurrent programming in mind.
Golang FAQ states that in the days before Go,
“One had to choose either efficient compilation,
efficient execution, or ease of programming; all
three were not available in the same mainstream
Language.”
Why Go?
● Why the Go Language Is Growing So Quickly?
Go is a programming language that’s only a decade old. It has rapidly grown in popularity for
optimization tasks that require lower level system access. In 2017, it was the fastest growing
language in the world, because it can handle many of the same tasks as C or C++. As those
languages have declined in popularity due to their complexity and confusing syntax, Go is
increasingly filling the gap left behind.
Go Features
1. Compile to Binary
One major strength of Go is it runs as a compiled application, without an interpreter or framework standing
in between. This means that Go compiles directly to binary machine code and runs directly. This makes Go
faster, but it also means you don’t have to agree on and install the same interpreter on all machines. Go
just works.
1. Garbage Collection
Unlike other direct-compile languages, however, Go supports added features for system cleanup. With
garbage collection included, you don’t need to remember to free up pointers or think about dangling
pointers. All that gets done automatically.
Go Features
3. Statically Typed
In Go, you’ll need to declare types for all variables and function arguments at compile time. This increases
the security of the language and points out errors early in the programming process. Especially for projects
with many developers over a long period of time, static typing makes functions and libraries easier to
understand.
4. No Exceptions
Go forces developers to handle basic errors themselves rather than rely on a try catch block or other
standard exception logic solutions. When you write in Go, you have to plan ahead for failure scenarios and
think critically about what your program needs.
Go Features
5. Concurrency & Routines
Concurrency and parallelism aren’t the same thing. Parallel processing involves multiple processor cores
working on different problems at the same time. Concurrency involves breaking multiple computations up
into smaller chunks and scheduling them for concurrent work on a single processor. This means that
various threads get broken up and processed in small bits over time.
With the rise of microservices and the need for multiple database connections, message queues, and
memory caches simultaneously, concurrent processing becomes increasingly important. Parallel and
concurrent processing are not mutually exclusive, and in fact, Go is well-positioned to be the go-to
language for data centers adding cores and looking for increased systems efficiency with multi-threading.
A Goroutine is a lightweight thread. When initialized it has a stack of 4KB, smaller and faster to initialize
than typical threads. Routines are also not mapped one-to-one with OS threads, and a single routine can
run across multiple OS threads. This enables hundreds of thousands of routines to run concurrently and in
parallel. The Go runtime scheduler manages and schedules all these threads for execution.
Go Features
6. Maintainable Syntax
Google places a premium on code that’s easy to understand because they have thousands of
developers who need to be able to share and understand each others’ code. Go intentionally
leaves out a lot of features for the sake of simplicity. There are no classes in Go, for example, only
packages. There’s also no inheritance, constructors, annotations, or generics. Go is as simple to
read as Ruby or Python, but it competes with C/C++ in terms of efficiency. It’s also built to be
backward compatible, and the syntax has remained stable since launch.
Go Features
Other Features
1. Safe
2. C - inspired syntax
3. Multi paradigm
4. Great Standard library
5. Simplified Documentation
6. Fast
7. Light Weight
8. Open-Source
9. Build-in testing tool
10. Go - routines
Go Important points
1. Object oriented without inheritance
2. Syntax sugar declaration
3. Strong and static types
4. Functions and methods which has receivers
5. Visibility based on the Case of First letter
6. Unused imports and variables causes errors
7. Excellent and complete standard library
8. Cross compilation capability
Go Users.
Go Installation
● Straight forward
● Well documented
● https://go.dev/doc/install
The Go Tool
The go tool is the standard tool for building, testing, and installing Go programs.
Compile and run hello.go:
Run zip tests:
Build and format the files in the current directory:
The Go Tool
The go tool is the standard tool for building, testing, and installing Go programs.
Fetch and install websocket:
Tool Commands :
● build - compile packages and dependencies
● clean - remove object files
● env - print go environment information
● fix - run go tool fix on packages
● fmt - run go fmt on package sources
● get - download and install packages and dependencies
● install - compile and install packages and dependencies
● list - list the packages
● run - compile and run go program
● test - test packages
● tool - run specified tool
● version - print go version
Go Structure
1. Package declaration
2. Import statements
3. Variables
4. Statements and Expressions
5. Functions
6. Comments
Go Datatypes
1. Basic type: Numbers, strings, and booleans come under this category.
2. Aggregate type: Array and structs come under this category.
3. Reference type: Pointers, slices, maps, functions, and channels come under this
category.
4. Interface type
Go Variables
1. var <v_name> <type>
2. var <v_name> <type> = expression
3. var <v_name> = expression
4. <v_name> := expression
Go Conditional Statements
1. If Statements
Go Conditional Statements
2. If else Statement
Go Conditional Statements
3. If else-if Statement
Go Conditional Statements
4.1 simple switch
Go Conditional Statements
4.2 fallthrough cases switch
Go Conditional Statements
4.3 multiple cases switch
Go Control Statements
● Go do not has while loops
● Go only has for loops
● For loops serves different purposes using different format
Traditional For loop :
Go Control Statements
For Range loop :
Go Control Statements
For loop over string :
Infinite loop:
Go Frameworks
● Gin
Gin is an HTTP web framework written in Go that is immensely popular with over 50k
stars on Github at the time of posting.
● Beego
Beego is another Go web framework that is mostly used to build enterprise web
applications with rapid development.
Go Frameworks
● Iris
Iris is an Express.js-equivalent web framework that is easier to use for
people coming from the Node.js community.
● Echo
Echo is another promising framework created by Labstack with 20k stars
on GitHub.
Go Frameworks
● Fiber
Fiber is another Express.js-like web framework written in Go that
boasts low memory usage and rich routing. Built on top of the
Fasthttp HTTP engine for Go
Go Frameworks
Framework Stars Forks
Gin 55,533 6,290
Beego 27,707 5,407
Iris 21,835 2,357
Echo 21,632 1,910
Fiber 18,255 953
FastHttp 16,899 1,421
Ravel 12,488 1,409
Martini 11,406 1,133
Buffalo 6,574 508
Go Scope
Aside from building general web applications, the language’s scope encompasses a wide range of use
cases:
● Command line application
● Cloud-native development
● Creating utilities and stand-alone libraries
● Developing databases, such as CockroachDB
● Game development
● Development operations
Go Docs and websites
Official Support
● https://go.dev/doc/
● https://go.dev/play/
● https://pkg.go.dev/
Other Support
● https://devdocs.io/go/
● https://www.golangprograms.com/go-language.html
● https://join.slack.com/t/gophers/shared_invite/zt-11ddswns3-S__IcQcJRsVqlmCDafl5_A
Go Drawbacks
1. Young Language, still developing
2. Absence of manual memory management
3. Error handling isn’t perfect
4. Lack of Function Overloading and Default Values for Arguments
5. Lack of Generics
6. No inheritance
Thank you.
Questions?
“Learn from yesterday, live for today, hope
for tomorrow. The important thing is not to
stop questioning.”
- Albert Einstein

More Related Content

What's hot

Why you should care about Go (Golang)
Why you should care about Go (Golang)Why you should care about Go (Golang)
Why you should care about Go (Golang)
Aaron Schlesinger
 
Go Language presentation
Go Language presentationGo Language presentation
Go Language presentation
Gh-Mohammed Eldadah
 
Go language presentation
Go language presentationGo language presentation
Go language presentation
paramisoft
 
Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
Sergey Pichkurov
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)
Ishin Vin
 
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
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
Uttam Gandhi
 
Introduction to Go programming language
Introduction to Go programming languageIntroduction to Go programming language
Introduction to Go programming language
Slawomir Dorzak
 
Golang 101
Golang 101Golang 101
Golang 101
宇 傅
 
Golang
GolangGolang
Golang
Felipe Mamud
 
GO programming language
GO programming languageGO programming language
GO programming language
tung vu
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
Guy Komari
 
GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction
Spandana Govindgari
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
Harshad Patil
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
Bo-Yi Wu
 
Go Lang Tutorial
Go Lang TutorialGo Lang Tutorial
Go Lang Tutorial
Wei-Ning Huang
 
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
Mahmoud Masih Tehrani
 
An introduction to programming in Go
An introduction to programming in GoAn introduction to programming in Go
An introduction to programming in Go
David Robert Camargo de Campos
 
Concurrency With Go
Concurrency With GoConcurrency With Go
Concurrency With Go
John-Alan Simmons
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
Tzar Umang
 

What's hot (20)

Why you should care about Go (Golang)
Why you should care about Go (Golang)Why you should care about Go (Golang)
Why you should care about Go (Golang)
 
Go Language presentation
Go Language presentationGo Language presentation
Go Language presentation
 
Go language presentation
Go language presentationGo language presentation
Go language presentation
 
Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
 
Introduction to Go programming language
Introduction to Go programming languageIntroduction to Go programming language
Introduction to Go programming language
 
Golang 101
Golang 101Golang 101
Golang 101
 
Golang
GolangGolang
Golang
 
GO programming language
GO programming languageGO programming language
GO programming language
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
 
GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
Go Lang Tutorial
Go Lang TutorialGo Lang Tutorial
Go Lang Tutorial
 
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
 
An introduction to programming in Go
An introduction to programming in GoAn introduction to programming in Go
An introduction to programming in Go
 
Concurrency With Go
Concurrency With GoConcurrency With Go
Concurrency With Go
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
 

Similar to Introduction to go lang

Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
Simon Hewitt
 
Advantages of golang development services &amp; 10 most used go frameworks
Advantages of golang development services &amp; 10 most used go frameworksAdvantages of golang development services &amp; 10 most used go frameworks
Advantages of golang development services &amp; 10 most used go frameworks
Katy Slemon
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with go
Vimlesh Sharma
 
Golang : A Hype or the Future?
Golang : A Hype or the Future?Golang : A Hype or the Future?
Golang : A Hype or the Future?
Mindfire LLC
 
Golang, Future of Programming Language.
Golang, Future of Programming Language.Golang, Future of Programming Language.
Golang, Future of Programming Language.
Sunil Yadav
 
Golang The Go Programming Language by startelelogic
Golang The Go Programming Language by startelelogicGolang The Go Programming Language by startelelogic
Golang The Go Programming Language by startelelogic
RituPatel551417
 
Features of go
Features of goFeatures of go
Features of go
Manjitsing Valvi
 
An Introduction to Go
An Introduction to GoAn Introduction to Go
An Introduction to Go
Imesh Gunaratne
 
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
 
Hire golang developers and make the shift to brighter business future (build ...
Hire golang developers and make the shift to brighter business future (build ...Hire golang developers and make the shift to brighter business future (build ...
Hire golang developers and make the shift to brighter business future (build ...
Katy Slemon
 
Beginning development in go
Beginning development in goBeginning development in go
Beginning development in go
Equaleyes Solutions Ltd.
 
Why Go Lang?
Why Go Lang?Why Go Lang?
Why Go Lang?
Sathish VJ
 
Go Within Cloud Foundry
Go Within Cloud FoundryGo Within Cloud Foundry
Go Within Cloud Foundry
Platform CF
 
5 Reasons why Business Choose Go Program for Software Development
5 Reasons why Business Choose Go Program for Software Development5 Reasons why Business Choose Go Program for Software Development
5 Reasons why Business Choose Go Program for Software Development
NelsonSEO
 
Go programming language
Go programming languageGo programming language
Go programming language
GoWitek Consulting Pvt.Ltd
 
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
 
Go fundamentals
Go fundamentalsGo fundamentals
Go fundamentals
Ron Barabash
 
NodeJS vs Golang - A detailed comparison
NodeJS vs Golang - A detailed comparisonNodeJS vs Golang - A detailed comparison
NodeJS vs Golang - A detailed comparison
Devathon
 
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
 

Similar to Introduction to go lang (20)

Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
 
Advantages of golang development services &amp; 10 most used go frameworks
Advantages of golang development services &amp; 10 most used go frameworksAdvantages of golang development services &amp; 10 most used go frameworks
Advantages of golang development services &amp; 10 most used go frameworks
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with go
 
Golang : A Hype or the Future?
Golang : A Hype or the Future?Golang : A Hype or the Future?
Golang : A Hype or the Future?
 
Golang, Future of Programming Language.
Golang, Future of Programming Language.Golang, Future of Programming Language.
Golang, Future of Programming Language.
 
Golang The Go Programming Language by startelelogic
Golang The Go Programming Language by startelelogicGolang The Go Programming Language by startelelogic
Golang The Go Programming Language by startelelogic
 
Features of go
Features of goFeatures of go
Features of go
 
An Introduction to Go
An Introduction to GoAn Introduction to Go
An Introduction to Go
 
welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?
 
Hire golang developers and make the shift to brighter business future (build ...
Hire golang developers and make the shift to brighter business future (build ...Hire golang developers and make the shift to brighter business future (build ...
Hire golang developers and make the shift to brighter business future (build ...
 
Beginning development in go
Beginning development in goBeginning development in go
Beginning development in go
 
Why Go Lang?
Why Go Lang?Why Go Lang?
Why Go Lang?
 
Go Within Cloud Foundry
Go Within Cloud FoundryGo Within Cloud Foundry
Go Within Cloud Foundry
 
5 Reasons why Business Choose Go Program for Software Development
5 Reasons why Business Choose Go Program for Software Development5 Reasons why Business Choose Go Program for Software Development
5 Reasons why Business Choose Go Program for Software Development
 
Go programming language
Go programming languageGo programming language
Go programming language
 
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
 
Go fundamentals
Go fundamentalsGo fundamentals
Go fundamentals
 
NodeJS vs Golang - A detailed comparison
NodeJS vs Golang - A detailed comparisonNodeJS vs Golang - A detailed comparison
NodeJS vs Golang - A detailed comparison
 
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
 

Recently uploaded

Development of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML TechnologiesDevelopment of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML Technologies
MaisnamLuwangPibarel
 
NBFC Software: Optimize Your Non-Banking Financial Company
NBFC Software: Optimize Your Non-Banking Financial CompanyNBFC Software: Optimize Your Non-Banking Financial Company
NBFC Software: Optimize Your Non-Banking Financial Company
NBFC Softwares
 
Splunk_Remote_Work_Insights_Overview.pptx
Splunk_Remote_Work_Insights_Overview.pptxSplunk_Remote_Work_Insights_Overview.pptx
Splunk_Remote_Work_Insights_Overview.pptx
sudsdeep
 
Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.
shivamt017
 
ThaiPy meetup - Indexes and Django
ThaiPy meetup - Indexes and DjangoThaiPy meetup - Indexes and Django
ThaiPy meetup - Indexes and Django
akshesh doshi
 
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
Hironori Washizaki
 
Google ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learningGoogle ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learning
VishrutGoyani1
 
React Native vs Flutter - SSTech System
React Native vs Flutter  - SSTech SystemReact Native vs Flutter  - SSTech System
React Native vs Flutter - SSTech System
SSTech System
 
MVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptxMVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptx
Mitchell Marsh
 
introduction of Ansys software and basic and advance knowledge of modelling s...
introduction of Ansys software and basic and advance knowledge of modelling s...introduction of Ansys software and basic and advance knowledge of modelling s...
introduction of Ansys software and basic and advance knowledge of modelling s...
sachin chaurasia
 
Break data silos with real-time connectivity using Confluent Cloud Connectors
Break data silos with real-time connectivity using Confluent Cloud ConnectorsBreak data silos with real-time connectivity using Confluent Cloud Connectors
Break data silos with real-time connectivity using Confluent Cloud Connectors
confluent
 
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptxWired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
SimonedeGijt
 
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
Roshan Dwivedi
 
Attendance Tracking From Paper To Digital
Attendance Tracking From Paper To DigitalAttendance Tracking From Paper To Digital
Attendance Tracking From Paper To Digital
Task Tracker
 
Safe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work PermitsSafe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work Permits
sheqnetworkmarketing
 
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
ThousandEyes
 
Addressing the Top 9 User Pain Points with Visual Design Elements.pptx
Addressing the Top 9 User Pain Points with Visual Design Elements.pptxAddressing the Top 9 User Pain Points with Visual Design Elements.pptx
Addressing the Top 9 User Pain Points with Visual Design Elements.pptx
Sparity1
 
CViewSurvey Digitech Pvt Ltd that works on a proven C.A.A.G. model.
CViewSurvey Digitech Pvt Ltd that  works on a proven C.A.A.G. model.CViewSurvey Digitech Pvt Ltd that  works on a proven C.A.A.G. model.
CViewSurvey Digitech Pvt Ltd that works on a proven C.A.A.G. model.
bhatinidhi2001
 
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
Semiosis Software Private Limited
 
Cultural Shifts: Embracing DevOps for Organizational Transformation
Cultural Shifts: Embracing DevOps for Organizational TransformationCultural Shifts: Embracing DevOps for Organizational Transformation
Cultural Shifts: Embracing DevOps for Organizational Transformation
Mindfire Solution
 

Recently uploaded (20)

Development of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML TechnologiesDevelopment of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML Technologies
 
NBFC Software: Optimize Your Non-Banking Financial Company
NBFC Software: Optimize Your Non-Banking Financial CompanyNBFC Software: Optimize Your Non-Banking Financial Company
NBFC Software: Optimize Your Non-Banking Financial Company
 
Splunk_Remote_Work_Insights_Overview.pptx
Splunk_Remote_Work_Insights_Overview.pptxSplunk_Remote_Work_Insights_Overview.pptx
Splunk_Remote_Work_Insights_Overview.pptx
 
Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.
 
ThaiPy meetup - Indexes and Django
ThaiPy meetup - Indexes and DjangoThaiPy meetup - Indexes and Django
ThaiPy meetup - Indexes and Django
 
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
 
Google ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learningGoogle ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learning
 
React Native vs Flutter - SSTech System
React Native vs Flutter  - SSTech SystemReact Native vs Flutter  - SSTech System
React Native vs Flutter - SSTech System
 
MVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptxMVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptx
 
introduction of Ansys software and basic and advance knowledge of modelling s...
introduction of Ansys software and basic and advance knowledge of modelling s...introduction of Ansys software and basic and advance knowledge of modelling s...
introduction of Ansys software and basic and advance knowledge of modelling s...
 
Break data silos with real-time connectivity using Confluent Cloud Connectors
Break data silos with real-time connectivity using Confluent Cloud ConnectorsBreak data silos with real-time connectivity using Confluent Cloud Connectors
Break data silos with real-time connectivity using Confluent Cloud Connectors
 
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptxWired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
 
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
 
Attendance Tracking From Paper To Digital
Attendance Tracking From Paper To DigitalAttendance Tracking From Paper To Digital
Attendance Tracking From Paper To Digital
 
Safe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work PermitsSafe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work Permits
 
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
 
Addressing the Top 9 User Pain Points with Visual Design Elements.pptx
Addressing the Top 9 User Pain Points with Visual Design Elements.pptxAddressing the Top 9 User Pain Points with Visual Design Elements.pptx
Addressing the Top 9 User Pain Points with Visual Design Elements.pptx
 
CViewSurvey Digitech Pvt Ltd that works on a proven C.A.A.G. model.
CViewSurvey Digitech Pvt Ltd that  works on a proven C.A.A.G. model.CViewSurvey Digitech Pvt Ltd that  works on a proven C.A.A.G. model.
CViewSurvey Digitech Pvt Ltd that works on a proven C.A.A.G. model.
 
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
 
Cultural Shifts: Embracing DevOps for Organizational Transformation
Cultural Shifts: Embracing DevOps for Organizational TransformationCultural Shifts: Embracing DevOps for Organizational Transformation
Cultural Shifts: Embracing DevOps for Organizational Transformation
 

Introduction to go lang

  • 2. Discussion Points ● History of Go. ● What is Go? ● What you’ll see in Go. ● What will you not see in Go. ● Why Go? ● Features ● Important Points. ● Who all are using Go ● Go installation ● Go Tools. ● Go structure. ● Types, Variables and Statements ● FrameWorks. ● Go Scope ● Go Docs ● Drawbacks
  • 3. Founders of Go. Ken Thompson Rob Pike Robert Griesemer Kenneth Lane Thompson is an American pioneer of computer science.Thompson worked at Bell Labs for most of his career where he designed and implemented the original Unix operating system. A Swiss computer scientist. He is best known for his work on the Go. Prior to Go, he worked on Google's V8 JavaScript engine, the Sawzall language, the Java HotSpot virtual machine, and the Strongtalk system. Robert "Rob" Pike is a Canadian programmer and author. He is best known for his work on the Go programming language and at Bell Labs, where he was a member of the Unix team.
  • 5. What is Go? ● Go is Open-Source General-Purpose programming language developed by Google. ● Solution to “BIG PROBLEMS” at Google.
  • 6. What you’ll see in Go. ● Compiled ● Garbage Collection ● Simple Syntax ● Great standard library ● Cross Platform ● Object Oriented (no Inheritance) ● Statically typed ● Extensive use of pointers ● Extensive use of Structures ● Extensive use of Interfaces ● Extensive use of If statements ● Extensive use of for loops ● Multiple returns
  • 7. What will you not see in Go. ● Exception Handling ● Inheritance ● Generics ● Assert ● Method Overloading ● Some loops ● Ternary Operator
  • 8. Why Go? ● Simplicity ● Eliminates Slowness ( Performance ). ● Secure and Easy to Maintain code. ● Concurrency ● Good Hardware Interaction. ● Speed for Production. ● Easy read, write, debug, and Maintain Large Software Systems (Google). ● Community For Starters
  • 9. Why Go? ● Why Go was developed when there already was many popular languages? Go was invented (in 2007) at a time when multicore CPU architectures were common.With multiple cores, code can run in parallel on all available cores; but there was no programming language that simplified the development of multithreaded applications. The responsibility of managing different threads safely and efficiently fell on developers. Thread-locking, race conditions and deadlocks are usual challenges. Go was designed with concurrent programming in mind. Golang FAQ states that in the days before Go, “One had to choose either efficient compilation, efficient execution, or ease of programming; all three were not available in the same mainstream Language.”
  • 10. Why Go? ● Why the Go Language Is Growing So Quickly? Go is a programming language that’s only a decade old. It has rapidly grown in popularity for optimization tasks that require lower level system access. In 2017, it was the fastest growing language in the world, because it can handle many of the same tasks as C or C++. As those languages have declined in popularity due to their complexity and confusing syntax, Go is increasingly filling the gap left behind.
  • 11. Go Features 1. Compile to Binary One major strength of Go is it runs as a compiled application, without an interpreter or framework standing in between. This means that Go compiles directly to binary machine code and runs directly. This makes Go faster, but it also means you don’t have to agree on and install the same interpreter on all machines. Go just works. 1. Garbage Collection Unlike other direct-compile languages, however, Go supports added features for system cleanup. With garbage collection included, you don’t need to remember to free up pointers or think about dangling pointers. All that gets done automatically.
  • 12. Go Features 3. Statically Typed In Go, you’ll need to declare types for all variables and function arguments at compile time. This increases the security of the language and points out errors early in the programming process. Especially for projects with many developers over a long period of time, static typing makes functions and libraries easier to understand. 4. No Exceptions Go forces developers to handle basic errors themselves rather than rely on a try catch block or other standard exception logic solutions. When you write in Go, you have to plan ahead for failure scenarios and think critically about what your program needs.
  • 13. Go Features 5. Concurrency & Routines Concurrency and parallelism aren’t the same thing. Parallel processing involves multiple processor cores working on different problems at the same time. Concurrency involves breaking multiple computations up into smaller chunks and scheduling them for concurrent work on a single processor. This means that various threads get broken up and processed in small bits over time. With the rise of microservices and the need for multiple database connections, message queues, and memory caches simultaneously, concurrent processing becomes increasingly important. Parallel and concurrent processing are not mutually exclusive, and in fact, Go is well-positioned to be the go-to language for data centers adding cores and looking for increased systems efficiency with multi-threading. A Goroutine is a lightweight thread. When initialized it has a stack of 4KB, smaller and faster to initialize than typical threads. Routines are also not mapped one-to-one with OS threads, and a single routine can run across multiple OS threads. This enables hundreds of thousands of routines to run concurrently and in parallel. The Go runtime scheduler manages and schedules all these threads for execution.
  • 14. Go Features 6. Maintainable Syntax Google places a premium on code that’s easy to understand because they have thousands of developers who need to be able to share and understand each others’ code. Go intentionally leaves out a lot of features for the sake of simplicity. There are no classes in Go, for example, only packages. There’s also no inheritance, constructors, annotations, or generics. Go is as simple to read as Ruby or Python, but it competes with C/C++ in terms of efficiency. It’s also built to be backward compatible, and the syntax has remained stable since launch.
  • 15. Go Features Other Features 1. Safe 2. C - inspired syntax 3. Multi paradigm 4. Great Standard library 5. Simplified Documentation 6. Fast 7. Light Weight 8. Open-Source 9. Build-in testing tool 10. Go - routines
  • 16. Go Important points 1. Object oriented without inheritance 2. Syntax sugar declaration 3. Strong and static types 4. Functions and methods which has receivers 5. Visibility based on the Case of First letter 6. Unused imports and variables causes errors 7. Excellent and complete standard library 8. Cross compilation capability
  • 18. Go Installation ● Straight forward ● Well documented ● https://go.dev/doc/install
  • 19. The Go Tool The go tool is the standard tool for building, testing, and installing Go programs. Compile and run hello.go: Run zip tests: Build and format the files in the current directory:
  • 20. The Go Tool The go tool is the standard tool for building, testing, and installing Go programs. Fetch and install websocket: Tool Commands : ● build - compile packages and dependencies ● clean - remove object files ● env - print go environment information ● fix - run go tool fix on packages ● fmt - run go fmt on package sources ● get - download and install packages and dependencies ● install - compile and install packages and dependencies ● list - list the packages ● run - compile and run go program ● test - test packages ● tool - run specified tool ● version - print go version
  • 21. Go Structure 1. Package declaration 2. Import statements 3. Variables 4. Statements and Expressions 5. Functions 6. Comments
  • 22. Go Datatypes 1. Basic type: Numbers, strings, and booleans come under this category. 2. Aggregate type: Array and structs come under this category. 3. Reference type: Pointers, slices, maps, functions, and channels come under this category. 4. Interface type
  • 23. Go Variables 1. var <v_name> <type> 2. var <v_name> <type> = expression 3. var <v_name> = expression 4. <v_name> := expression
  • 25. Go Conditional Statements 2. If else Statement
  • 26. Go Conditional Statements 3. If else-if Statement
  • 28. Go Conditional Statements 4.2 fallthrough cases switch
  • 29. Go Conditional Statements 4.3 multiple cases switch
  • 30. Go Control Statements ● Go do not has while loops ● Go only has for loops ● For loops serves different purposes using different format Traditional For loop :
  • 32. Go Control Statements For loop over string : Infinite loop:
  • 33. Go Frameworks ● Gin Gin is an HTTP web framework written in Go that is immensely popular with over 50k stars on Github at the time of posting. ● Beego Beego is another Go web framework that is mostly used to build enterprise web applications with rapid development.
  • 34. Go Frameworks ● Iris Iris is an Express.js-equivalent web framework that is easier to use for people coming from the Node.js community. ● Echo Echo is another promising framework created by Labstack with 20k stars on GitHub.
  • 35. Go Frameworks ● Fiber Fiber is another Express.js-like web framework written in Go that boasts low memory usage and rich routing. Built on top of the Fasthttp HTTP engine for Go
  • 36. Go Frameworks Framework Stars Forks Gin 55,533 6,290 Beego 27,707 5,407 Iris 21,835 2,357 Echo 21,632 1,910 Fiber 18,255 953 FastHttp 16,899 1,421 Ravel 12,488 1,409 Martini 11,406 1,133 Buffalo 6,574 508
  • 37. Go Scope Aside from building general web applications, the language’s scope encompasses a wide range of use cases: ● Command line application ● Cloud-native development ● Creating utilities and stand-alone libraries ● Developing databases, such as CockroachDB ● Game development ● Development operations
  • 38. Go Docs and websites Official Support ● https://go.dev/doc/ ● https://go.dev/play/ ● https://pkg.go.dev/ Other Support ● https://devdocs.io/go/ ● https://www.golangprograms.com/go-language.html ● https://join.slack.com/t/gophers/shared_invite/zt-11ddswns3-S__IcQcJRsVqlmCDafl5_A
  • 39. Go Drawbacks 1. Young Language, still developing 2. Absence of manual memory management 3. Error handling isn’t perfect 4. Lack of Function Overloading and Default Values for Arguments 5. Lack of Generics 6. No inheritance
  • 40. Thank you. Questions? “Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.” - Albert Einstein