SlideShare a Scribd company logo
1 of 27
The Go
Programming
Language
By İbrahim Kürce
Quoted from John Sonmez
Three chapters: Go Overview, Go Development and Variables, Types, Pointers
1 – Go Overview – What is Go?
 Compiled
 Garbage-collected
 Concurrent
Compiled
 Code adapted to machine that they’re running on
 Compiled down to machine languages like C, C++
 More efficient and better performance than interpreted languages
 Supported operating systems: Linux, Mac OS
X, FreeBSD, OpenBSD, Plan 9, Windows
 Supported processors: i386, amd64, ARM
Garbage-collected
 You do not have to manage memory as programmer, unlike C, C++
 Runtime handles for you
 Garbage collection is very fast, latency free
Concurrent
 Concurrency is to do more than one thing at a time
 Programming languages like C++ and Java, concurrency is possible but hard to
manage. It is not part of language
 Go has built in concurrency support
 It is called Go Routines for concurrent functions
Go’s Origins
 Three Google engineers want a system level languages for aging systems level
languages
 Go was designed very fast compiling language
Sept 2007
Dream of Go
March 2012
Go 1
released
May 2010
Used
internally at
Google
Nov 2009
Officially
announced
What makes Go different?
 Efficient like a static language, ease of use like dynamic language
 Type-safe and memory-safe
 Latency free garbage collection
 Fast compile times
 It does not have assertions and method overloading
2 – Go Development - Packages
 Way to modularize code
 Similar to namespaces
 Collection of types and functions
 Can import packages in your code
 Redistribute those packages
 A lot of built-in packages, https://golang.org/pkg/
Imports
Code.go
Source code
Local packages
Remote packages
Imports
 Go knows whether your code needs those packages
 Has ability to go out and get remote packages
 Your code could refer to github etc. repositories
Hello World
package main Required package name "main"
import "fmt" Package comes with Go
func main(){ Curly braces is near by function name
fmt.Println("Hello World")
}
Println start with upper case, cause it is exported method
Hello World
 Direct run, not generate .exe file
go run hello.go
 To Build to generate .exe file
go build hello.go
 To run after build
hello.exe
3 – Variables, Types and Pointers
 Basic Types
 bool
 string
 int, int8, int16, int32, int64
 uint, uint8, uint16, uint32, uint64, uintptr
 byte(unit8)
 rune(int32), like a char
 float32, float64
 complex64, complex128
Types
 Other types
 Array
 Slice
 Struct
 Pointer
 Function
 Interface
 Map
 Channel
Basic Declaration
Multi-Declaration and Initialization
Multi-Declaration and Initialization
 Default value is 0 for int types
 Default value is always set in Go language
Without Types Without var
Multi-Declaration and Initialization
 Do not need to have same type in multi-declaration
Pointer Basics
 Pointer is a type of variable that is going to contain a memory address of another
variable
 string pointer has same type with string type
Hello
World
0xc042
00a270
Pointer Basics, Passing Things
 Pointer’s type is that type is going to refer to what type of variable
 We pass value in Go function, this value will be copied, inside function, we change
this value, originial value is not changed
function
43
43
function
43
45
Passing Things
 If we pass a pointer to function, pointer also will be copied but it points same
memory location. So if we change value inside function, originial value will also be
changed
function
43
0x0123
0x0123
Basic Pointer Example
 greeting is a pointer, if we write it directly, it shows memory address
 If we write *greeting, it shows Hello world
Pointer Assignment
 If we change value of pointer, we also change originial value
No Classes in Go
 Go is not object-oriented language
 Instead of using classes in Go, we use what’s called user define types
 For example;
Basic User Types
 Salutation struct definition
Constants
 In Go, you can define constants without defining the type
 PI is numeric, Language is string type
 A, B, C = 0, 1, 2 respectively
End of Go Overview, Go Development and
Variables, Types, Pointers

More Related Content

What's hot

Full Python in 20 slides
Full Python in 20 slidesFull Python in 20 slides
Full Python in 20 slides
rfojdar
 
Ap Power Point Chpt7
Ap Power Point Chpt7Ap Power Point Chpt7
Ap Power Point Chpt7
dplunkett
 

What's hot (20)

C++ Object oriented concepts & programming
C++ Object oriented concepts & programmingC++ Object oriented concepts & programming
C++ Object oriented concepts & programming
 
Introduction to-programming
Introduction to-programmingIntroduction to-programming
Introduction to-programming
 
Structure of java program diff c- cpp and java
Structure of java program  diff c- cpp and javaStructure of java program  diff c- cpp and java
Structure of java program diff c- cpp and java
 
Full Python in 20 slides
Full Python in 20 slidesFull Python in 20 slides
Full Python in 20 slides
 
C#
C#C#
C#
 
OCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIsOCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIs
 
Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)
 
Java Interview Questions For Freshers
Java Interview Questions For FreshersJava Interview Questions For Freshers
Java Interview Questions For Freshers
 
OOP java
OOP javaOOP java
OOP java
 
Effective Java - Chapter 3: Methods Common to All Objects
Effective Java - Chapter 3: Methods Common to All ObjectsEffective Java - Chapter 3: Methods Common to All Objects
Effective Java - Chapter 3: Methods Common to All Objects
 
Unit 1 Java
Unit 1 JavaUnit 1 Java
Unit 1 Java
 
Object-oriented Programming in Python
Object-oriented Programming in PythonObject-oriented Programming in Python
Object-oriented Programming in Python
 
Comparable/ Comparator
Comparable/ ComparatorComparable/ Comparator
Comparable/ Comparator
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
 
Java beans
Java beansJava beans
Java beans
 
Comparable and comparator – a detailed discussion
Comparable and comparator – a detailed discussionComparable and comparator – a detailed discussion
Comparable and comparator – a detailed discussion
 
Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classes
 
OCA Java SE 8 Exam Chapter 6 Exceptions
OCA Java SE 8 Exam Chapter 6 ExceptionsOCA Java SE 8 Exam Chapter 6 Exceptions
OCA Java SE 8 Exam Chapter 6 Exceptions
 
Ap Power Point Chpt7
Ap Power Point Chpt7Ap Power Point Chpt7
Ap Power Point Chpt7
 
C# interview quesions
C# interview quesionsC# interview quesions
C# interview quesions
 

Viewers also liked

Viewers also liked (8)

Effective Java - Chapter 2: Creating and Destroying Objects
Effective Java - Chapter 2: Creating and Destroying ObjectsEffective Java - Chapter 2: Creating and Destroying Objects
Effective Java - Chapter 2: Creating and Destroying Objects
 
Effective Java - Generics
Effective Java - GenericsEffective Java - Generics
Effective Java - Generics
 
Effective Java - Enum and Annotations
Effective Java - Enum and AnnotationsEffective Java - Enum and Annotations
Effective Java - Enum and Annotations
 
Effective java 1 and 2
Effective java 1 and 2Effective java 1 and 2
Effective java 1 and 2
 
Effective Java - Chapter 4: Classes and Interfaces
Effective Java - Chapter 4: Classes and InterfacesEffective Java - Chapter 4: Classes and Interfaces
Effective Java - Chapter 4: Classes and Interfaces
 
Effective Java
Effective JavaEffective Java
Effective Java
 
Effective java
Effective javaEffective java
Effective java
 
Effective java
Effective javaEffective java
Effective java
 

Similar to The Go Programing Language 1

Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)
Muhammad Haseeb Shahid
 
Java (1).ppt seminar topics engineering
Java (1).ppt  seminar topics engineeringJava (1).ppt  seminar topics engineering
Java (1).ppt seminar topics engineering
4MU21CS023
 

Similar to The Go Programing Language 1 (20)

Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
The GO programming language
The GO programming languageThe GO programming language
The GO programming language
 
Beginning development in go
Beginning development in goBeginning development in go
Beginning development in go
 
Go programing language
Go programing languageGo programing language
Go programing language
 
Let's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming LanguageLet's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming Language
 
Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language
 
How a Compiler Works ?
How a Compiler Works ?How a Compiler Works ?
How a Compiler Works ?
 
INTRODUCTION TO C LANGUAGE.pptx
INTRODUCTION TO C LANGUAGE.pptxINTRODUCTION TO C LANGUAGE.pptx
INTRODUCTION TO C LANGUAGE.pptx
 
The Ring programming language version 1.3 book - Part 4 of 88
The Ring programming language version 1.3 book - Part 4 of 88The Ring programming language version 1.3 book - Part 4 of 88
The Ring programming language version 1.3 book - Part 4 of 88
 
Golang online course
Golang online courseGolang online course
Golang online course
 
Presentation c++
Presentation c++Presentation c++
Presentation c++
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
 
Introduction to Programming in Go
Introduction to Programming in GoIntroduction to Programming in Go
Introduction to Programming in Go
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
C++ Langauage Training in Ambala ! BATRA COMPUTER CENTRE
C++  Langauage Training in Ambala ! BATRA COMPUTER CENTREC++  Langauage Training in Ambala ! BATRA COMPUTER CENTRE
C++ Langauage Training in Ambala ! BATRA COMPUTER CENTRE
 
Python final presentation kirti ppt1
Python final presentation kirti ppt1Python final presentation kirti ppt1
Python final presentation kirti ppt1
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
 
Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)Page List & Sample Material (Repaired)
Page List & Sample Material (Repaired)
 
Java (1).ppt seminar topics engineering
Java (1).ppt  seminar topics engineeringJava (1).ppt  seminar topics engineering
Java (1).ppt seminar topics engineering
 
durga python full.pdf
durga python full.pdfdurga python full.pdf
durga python full.pdf
 

Recently uploaded

%+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
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
%+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
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Recently uploaded (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%+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...
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%+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...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 

The Go Programing Language 1

  • 1. The Go Programming Language By İbrahim Kürce Quoted from John Sonmez Three chapters: Go Overview, Go Development and Variables, Types, Pointers
  • 2. 1 – Go Overview – What is Go?  Compiled  Garbage-collected  Concurrent
  • 3. Compiled  Code adapted to machine that they’re running on  Compiled down to machine languages like C, C++  More efficient and better performance than interpreted languages  Supported operating systems: Linux, Mac OS X, FreeBSD, OpenBSD, Plan 9, Windows  Supported processors: i386, amd64, ARM
  • 4. Garbage-collected  You do not have to manage memory as programmer, unlike C, C++  Runtime handles for you  Garbage collection is very fast, latency free
  • 5. Concurrent  Concurrency is to do more than one thing at a time  Programming languages like C++ and Java, concurrency is possible but hard to manage. It is not part of language  Go has built in concurrency support  It is called Go Routines for concurrent functions
  • 6. Go’s Origins  Three Google engineers want a system level languages for aging systems level languages  Go was designed very fast compiling language Sept 2007 Dream of Go March 2012 Go 1 released May 2010 Used internally at Google Nov 2009 Officially announced
  • 7. What makes Go different?  Efficient like a static language, ease of use like dynamic language  Type-safe and memory-safe  Latency free garbage collection  Fast compile times  It does not have assertions and method overloading
  • 8. 2 – Go Development - Packages  Way to modularize code  Similar to namespaces  Collection of types and functions  Can import packages in your code  Redistribute those packages  A lot of built-in packages, https://golang.org/pkg/
  • 10. Imports  Go knows whether your code needs those packages  Has ability to go out and get remote packages  Your code could refer to github etc. repositories
  • 11. Hello World package main Required package name "main" import "fmt" Package comes with Go func main(){ Curly braces is near by function name fmt.Println("Hello World") } Println start with upper case, cause it is exported method
  • 12. Hello World  Direct run, not generate .exe file go run hello.go  To Build to generate .exe file go build hello.go  To run after build hello.exe
  • 13. 3 – Variables, Types and Pointers  Basic Types  bool  string  int, int8, int16, int32, int64  uint, uint8, uint16, uint32, uint64, uintptr  byte(unit8)  rune(int32), like a char  float32, float64  complex64, complex128
  • 14. Types  Other types  Array  Slice  Struct  Pointer  Function  Interface  Map  Channel
  • 17. Multi-Declaration and Initialization  Default value is 0 for int types  Default value is always set in Go language Without Types Without var
  • 18. Multi-Declaration and Initialization  Do not need to have same type in multi-declaration
  • 19. Pointer Basics  Pointer is a type of variable that is going to contain a memory address of another variable  string pointer has same type with string type Hello World 0xc042 00a270
  • 20. Pointer Basics, Passing Things  Pointer’s type is that type is going to refer to what type of variable  We pass value in Go function, this value will be copied, inside function, we change this value, originial value is not changed function 43 43 function 43 45
  • 21. Passing Things  If we pass a pointer to function, pointer also will be copied but it points same memory location. So if we change value inside function, originial value will also be changed function 43 0x0123 0x0123
  • 22. Basic Pointer Example  greeting is a pointer, if we write it directly, it shows memory address  If we write *greeting, it shows Hello world
  • 23. Pointer Assignment  If we change value of pointer, we also change originial value
  • 24. No Classes in Go  Go is not object-oriented language  Instead of using classes in Go, we use what’s called user define types  For example;
  • 25. Basic User Types  Salutation struct definition
  • 26. Constants  In Go, you can define constants without defining the type  PI is numeric, Language is string type  A, B, C = 0, 1, 2 respectively
  • 27. End of Go Overview, Go Development and Variables, Types, Pointers