SlideShare uma empresa Scribd logo
1 de 40
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

Mais conteúdo relacionado

Mais procurados

Go language presentation
Go language presentationGo language presentation
Go language presentationparamisoft
 
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
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptxGuy Komari
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by GoogleUttam Gandhi
 
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
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)Ishin Vin
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)ShubhamMishra485
 
Golang 101
Golang 101Golang 101
Golang 101宇 傅
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewMarkus Schneider
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golangBo-Yi Wu
 
GO programming language
GO programming languageGO programming language
GO programming languagetung vu
 
Goroutines and Channels in practice
Goroutines and Channels in practiceGoroutines and Channels in practice
Goroutines and Channels in practiceGuilherme Garnier
 
Introduction to Go programming
Introduction to Go programmingIntroduction to Go programming
Introduction to Go programmingExotel
 

Mais procurados (20)

Golang
GolangGolang
Golang
 
Go language presentation
Go language presentationGo language presentation
Go language presentation
 
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)
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
 
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 Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)
 
GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction
 
Go Lang Tutorial
Go Lang TutorialGo Lang Tutorial
Go Lang Tutorial
 
Golang
GolangGolang
Golang
 
Golang 101
Golang 101Golang 101
Golang 101
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / Overview
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
Concurrency With Go
Concurrency With GoConcurrency With Go
Concurrency With Go
 
Golang Template
Golang TemplateGolang Template
Golang Template
 
GO programming language
GO programming languageGO programming language
GO programming language
 
Goroutines and Channels in practice
Goroutines and Channels in practiceGoroutines and Channels in practice
Goroutines and Channels in practice
 
Introduction to Go programming
Introduction to Go programmingIntroduction to Go programming
Introduction to Go programming
 

Semelhante a Introduction to go lang

Introduction to Go
Introduction to GoIntroduction to Go
Introduction to GoSimon 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 frameworksKaty Slemon
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with goVimlesh 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
 
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
 
Go Within Cloud Foundry
Go Within Cloud FoundryGo Within Cloud Foundry
Go Within Cloud FoundryPlatform 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 DevelopmentNelsonSEO
 
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 LanguageGanesh Samarthyam
 
NodeJS vs Golang - A detailed comparison
NodeJS vs Golang - A detailed comparisonNodeJS vs Golang - A detailed comparison
NodeJS vs Golang - A detailed comparisonDevathon
 
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 2016Codemotion
 

Semelhante a 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.
 
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
 
Golang
GolangGolang
Golang
 

Último

WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 

Último (20)

WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 

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