際際滷

際際滷Share a Scribd company logo
So you think you know Go? 
The Go Programming Language 
Presented by John Potocny @ATO 2014
About Me 
Backend Developer at VividCortex, BCE from Kettering University 
Programming Experience: Mainly C#/Java, Embedded C/C++, some Python 
Twitter: @JohnPotocny1 
Email: johnp@vividcortex.com
A Brief History 
 Created in 2007 by Robert Griesemer, Rob Pike, & Ken Thompson 
 Developed by Google 
 Open Source - since Nov 10, 2009 (Public Announcement) 
 Currently v1.3.3 (Stable)
What Kind of Language is Go?
Language Features
Actually, Its More Like This
Great Tools Built-In
Compiles Quickly - Native Binary
Garbage Collected
Statically Typed
Interfaces and Composition
Concurrency
What Did Go Get Rid Of?
Remember The Goals!
Enough Chat, Lets See Some Code!
A Modern Hello World
A Modern Hello World
How About a Real Example?
How About a Web Server? 
http://play.golang.org/p/r-__BazPxE
How About a Web Server? 
http://play.golang.org/p/r-__BazPxE 
Or Even:
Server With Limited Connections? 
http://play.golang.org/p/OMian3YwlD
No Language Is Perfect...
A Fun Example 
http://play.golang.org/p/kPFCYuNTTG
Other Things?
No Generics
Go Has Complex Numbers
Static Types - No Implicit Conversion
ATO 2014 - So You Think You Know 'Go'? The Go Programming Language
Strict Compiler Interrupts Flow
Race Conditions Still Exist
Wait, Go Has g看岳看!?
Other Fun Keywords 
Proof: http://play.golang.org/p/dFBcMMHq0a
Questions?
Thank You!

More Related Content

Viewers also liked (12)

Introduction Scala - Michel Schinz - January 2010
Introduction  Scala - Michel Schinz - January 2010Introduction  Scala - Michel Schinz - January 2010
Introduction Scala - Michel Schinz - January 2010
JUG Lausanne
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
Uttam Gandhi
Physical Computing Using Go and Arduino
Physical Computing Using Go and ArduinoPhysical Computing Using Go and Arduino
Physical Computing Using Go and Arduino
Justin Grammens
10 reasons to be excited about go
10 reasons to be excited about go10 reasons to be excited about go
10 reasons to be excited about go
Dvir Volk
Golang
GolangGolang
Golang
Felipe Mamud
Google Go! language
Google Go! languageGoogle Go! language
Google Go! language
Andr辿 Mayer
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
Mahmoud Masih Tehrani
Golang
GolangGolang
Golang
Michael Blake
Go Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang wayGo Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang way
IndicThreads
About Go
About GoAbout Go
About Go
Jongmin Kim
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
Introduction to Go programming
Introduction to Go programmingIntroduction to Go programming
Introduction to Go programming
Exotel
Introduction Scala - Michel Schinz - January 2010
Introduction  Scala - Michel Schinz - January 2010Introduction  Scala - Michel Schinz - January 2010
Introduction Scala - Michel Schinz - January 2010
JUG Lausanne
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
Uttam Gandhi
Physical Computing Using Go and Arduino
Physical Computing Using Go and ArduinoPhysical Computing Using Go and Arduino
Physical Computing Using Go and Arduino
Justin Grammens
10 reasons to be excited about go
10 reasons to be excited about go10 reasons to be excited about go
10 reasons to be excited about go
Dvir Volk
Google Go! language
Google Go! languageGoogle Go! language
Google Go! language
Andr辿 Mayer
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
Mahmoud Masih Tehrani
Go Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang wayGo Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang way
IndicThreads
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
Introduction to Go programming
Introduction to Go programmingIntroduction to Go programming
Introduction to Go programming
Exotel

Similar to ATO 2014 - So You Think You Know 'Go'? The Go Programming Language (20)

So You Think You Know 'Go'? The Go Programming Language
So You Think You Know 'Go'? The Go Programming LanguageSo You Think You Know 'Go'? The Go Programming Language
So You Think You Know 'Go'? The Go Programming Language
All Things Open
GSoC: How to get prepared and write a good proposal (or how to start contribu...
GSoC: How to get prepared and write a good proposal (or how to start contribu...GSoC: How to get prepared and write a good proposal (or how to start contribu...
GSoC: How to get prepared and write a good proposal (or how to start contribu...
Jo達o Paulo Rechi Vita
The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180
Mahmoud Samir Fayed
Python Way of Program is a topic for beginners
Python Way of Program is a topic for beginnersPython Way of Program is a topic for beginners
Python Way of Program is a topic for beginners
riazahamed37
Python Way of Program is a topic for beginners
Python Way of Program is a topic for beginnersPython Way of Program is a topic for beginners
Python Way of Program is a topic for beginners
riazahamed37
Introduction To Python
Introduction To PythonIntroduction To Python
Introduction To Python
Biswajeet Dasmajumdar
The Awesomeness of Go
The Awesomeness of GoThe Awesomeness of Go
The Awesomeness of Go
Christina Rasimus
How to discover contribution item ?
How to discover contribution item ?How to discover contribution item ?
How to discover contribution item ?
Gyuyoung Kim
How to master a programming language: a Golang example"
How to master a programming language: a Golang example"How to master a programming language: a Golang example"
How to master a programming language: a Golang example"
Evan Lin
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
hemantmohite6
際際滷s kotlin yajug
際際滷s kotlin yajug際際滷s kotlin yajug
際際滷s kotlin yajug
Bastien Ladron
Android is going to Go! Android and Golang
Android is going to Go! Android and GolangAndroid is going to Go! Android and Golang
Android is going to Go! Android and Golang
Almog Baku
Android is going to Go! - Android and goland - Almog Baku
Android is going to Go! - Android and goland - Almog BakuAndroid is going to Go! - Android and goland - Almog Baku
Android is going to Go! - Android and goland - Almog Baku
DroidConTLV
The Ring programming language version 1.5.4 book - Part 5 of 185
The Ring programming language version 1.5.4 book - Part 5 of 185The Ring programming language version 1.5.4 book - Part 5 of 185
The Ring programming language version 1.5.4 book - Part 5 of 185
Mahmoud Samir Fayed
PYTHON TUTORIALS.pptx
PYTHON TUTORIALS.pptxPYTHON TUTORIALS.pptx
PYTHON TUTORIALS.pptx
EzatIlman1
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp
Bot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent EllerbachBot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent Ellerbach
ITCamp
The Ring programming language version 1.5.3 book - Part 5 of 184
The Ring programming language version 1.5.3 book - Part 5 of 184The Ring programming language version 1.5.3 book - Part 5 of 184
The Ring programming language version 1.5.3 book - Part 5 of 184
Mahmoud Samir Fayed
Practical implementation of Natural language processing with python
Practical implementation of Natural language processing with pythonPractical implementation of Natural language processing with python
Practical implementation of Natural language processing with python
AbdulkereemKereem
Intro to Python Programming
Intro to Python ProgrammingIntro to Python Programming
Intro to Python Programming
ssuser65af26
So You Think You Know 'Go'? The Go Programming Language
So You Think You Know 'Go'? The Go Programming LanguageSo You Think You Know 'Go'? The Go Programming Language
So You Think You Know 'Go'? The Go Programming Language
All Things Open
GSoC: How to get prepared and write a good proposal (or how to start contribu...
GSoC: How to get prepared and write a good proposal (or how to start contribu...GSoC: How to get prepared and write a good proposal (or how to start contribu...
GSoC: How to get prepared and write a good proposal (or how to start contribu...
Jo達o Paulo Rechi Vita
The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180
Mahmoud Samir Fayed
Python Way of Program is a topic for beginners
Python Way of Program is a topic for beginnersPython Way of Program is a topic for beginners
Python Way of Program is a topic for beginners
riazahamed37
Python Way of Program is a topic for beginners
Python Way of Program is a topic for beginnersPython Way of Program is a topic for beginners
Python Way of Program is a topic for beginners
riazahamed37
How to discover contribution item ?
How to discover contribution item ?How to discover contribution item ?
How to discover contribution item ?
Gyuyoung Kim
How to master a programming language: a Golang example"
How to master a programming language: a Golang example"How to master a programming language: a Golang example"
How to master a programming language: a Golang example"
Evan Lin
際際滷s kotlin yajug
際際滷s kotlin yajug際際滷s kotlin yajug
際際滷s kotlin yajug
Bastien Ladron
Android is going to Go! Android and Golang
Android is going to Go! Android and GolangAndroid is going to Go! Android and Golang
Android is going to Go! Android and Golang
Almog Baku
Android is going to Go! - Android and goland - Almog Baku
Android is going to Go! - Android and goland - Almog BakuAndroid is going to Go! - Android and goland - Almog Baku
Android is going to Go! - Android and goland - Almog Baku
DroidConTLV
The Ring programming language version 1.5.4 book - Part 5 of 185
The Ring programming language version 1.5.4 book - Part 5 of 185The Ring programming language version 1.5.4 book - Part 5 of 185
The Ring programming language version 1.5.4 book - Part 5 of 185
Mahmoud Samir Fayed
PYTHON TUTORIALS.pptx
PYTHON TUTORIALS.pptxPYTHON TUTORIALS.pptx
PYTHON TUTORIALS.pptx
EzatIlman1
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp
Bot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent EllerbachBot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent Ellerbach
ITCamp
The Ring programming language version 1.5.3 book - Part 5 of 184
The Ring programming language version 1.5.3 book - Part 5 of 184The Ring programming language version 1.5.3 book - Part 5 of 184
The Ring programming language version 1.5.3 book - Part 5 of 184
Mahmoud Samir Fayed
Practical implementation of Natural language processing with python
Practical implementation of Natural language processing with pythonPractical implementation of Natural language processing with python
Practical implementation of Natural language processing with python
AbdulkereemKereem
Intro to Python Programming
Intro to Python ProgrammingIntro to Python Programming
Intro to Python Programming
ssuser65af26

Recently uploaded (20)

VADY: Unlocking Growth Through Data-Driven CFO Strategies
VADY: Unlocking Growth Through Data-Driven CFO StrategiesVADY: Unlocking Growth Through Data-Driven CFO Strategies
VADY: Unlocking Growth Through Data-Driven CFO Strategies
NewFangledVision
The Rise of AI and Machine Learning in Mobile App Development.pdf
The Rise of AI and Machine Learning in Mobile App Development.pdfThe Rise of AI and Machine Learning in Mobile App Development.pdf
The Rise of AI and Machine Learning in Mobile App Development.pdf
Lilly Gracia
Minitool Partition Wizard Crack Free Download
Minitool Partition Wizard Crack Free DownloadMinitool Partition Wizard Crack Free Download
Minitool Partition Wizard Crack Free Download
v3r2eptd2q
How Biometric Attendance Systems Reduce Payroll Fraud & Costs?
How Biometric Attendance Systems Reduce Payroll Fraud & Costs?How Biometric Attendance Systems Reduce Payroll Fraud & Costs?
How Biometric Attendance Systems Reduce Payroll Fraud & Costs?
Star Link Communication Pvt Ltd
EASEUS Partition Master Crack with License Code [Latest]
EASEUS Partition Master Crack with License Code [Latest]EASEUS Partition Master Crack with License Code [Latest]
EASEUS Partition Master Crack with License Code [Latest]
bhagasufyan
SAP Document Compliance Overview -Imp document.pdf
SAP Document Compliance Overview -Imp document.pdfSAP Document Compliance Overview -Imp document.pdf
SAP Document Compliance Overview -Imp document.pdf
annapureddyn
Why Hire Python Developers? Key Benefits for Your Business
Why Hire Python Developers? Key Benefits for Your BusinessWhy Hire Python Developers? Key Benefits for Your Business
Why Hire Python Developers? Key Benefits for Your Business
Mypcot Infotech
Best Solution For Import and Export Contacts from VCF to CSV
Best Solution For Import and Export Contacts from VCF to CSVBest Solution For Import and Export Contacts from VCF to CSV
Best Solution For Import and Export Contacts from VCF to CSV
sung231
Metaverse Meetup: Explore Mulesoft MAC Project
Metaverse Meetup: Explore  Mulesoft MAC ProjectMetaverse Meetup: Explore  Mulesoft MAC Project
Metaverse Meetup: Explore Mulesoft MAC Project
GiulioPicchi
Odoo WooCommerce Connector, Multiple Woocommerce store connection
Odoo WooCommerce Connector,  Multiple Woocommerce store connectionOdoo WooCommerce Connector,  Multiple Woocommerce store connection
Odoo WooCommerce Connector, Multiple Woocommerce store connection
Aagam infotech
The evolution of Web Rendering Architectures
The evolution of Web Rendering ArchitecturesThe evolution of Web Rendering Architectures
The evolution of Web Rendering Architectures
Evangelia Mitsopoulou
How John started to like TDD (instead of hating it) - TED talk
How John started to like TDD (instead of hating it) - TED talkHow John started to like TDD (instead of hating it) - TED talk
How John started to like TDD (instead of hating it) - TED talk
Nacho Cougil
Alluxio Webinar | Whats New in Alluxio AI: 3X Faster Checkpoint File Creatio...
Alluxio Webinar | Whats New in Alluxio AI: 3X Faster Checkpoint File Creatio...Alluxio Webinar | Whats New in Alluxio AI: 3X Faster Checkpoint File Creatio...
Alluxio Webinar | Whats New in Alluxio AI: 3X Faster Checkpoint File Creatio...
Alluxio, Inc.
Online Software Testing Training Institute in Delhi Ncr
Online Software Testing Training Institute in Delhi NcrOnline Software Testing Training Institute in Delhi Ncr
Online Software Testing Training Institute in Delhi Ncr
Home
SketchUp Pro Crack [2025]-Free Download?
SketchUp Pro Crack [2025]-Free Download?SketchUp Pro Crack [2025]-Free Download?
SketchUp Pro Crack [2025]-Free Download?
kiran10101khan
A Brief Introduction About Raman Bhaumik
A Brief Introduction About Raman BhaumikA Brief Introduction About Raman Bhaumik
A Brief Introduction About Raman Bhaumik
Raman Bhaumik
The Role of Blockchain in Transparent & Secure Procurement.pptx
The Role of Blockchain in Transparent & Secure Procurement.pptxThe Role of Blockchain in Transparent & Secure Procurement.pptx
The Role of Blockchain in Transparent & Secure Procurement.pptx
asmith539880
Enscape Latest 2025 Crack Free Download
Enscape Latest 2025  Crack Free DownloadEnscape Latest 2025  Crack Free Download
Enscape Latest 2025 Crack Free Download
rnzu5cxw0y
Douwan Preactivated Plus Crack 2025-Latest
Douwan Preactivated Plus Crack 2025-LatestDouwan Preactivated Plus Crack 2025-Latest
Douwan Preactivated Plus Crack 2025-Latest
mubeen010khan
Cybersecurity & Innovation: The Future of Mobile App Development
Cybersecurity & Innovation: The Future of Mobile App DevelopmentCybersecurity & Innovation: The Future of Mobile App Development
Cybersecurity & Innovation: The Future of Mobile App Development
iProgrammer Solutions Private Limited
VADY: Unlocking Growth Through Data-Driven CFO Strategies
VADY: Unlocking Growth Through Data-Driven CFO StrategiesVADY: Unlocking Growth Through Data-Driven CFO Strategies
VADY: Unlocking Growth Through Data-Driven CFO Strategies
NewFangledVision
The Rise of AI and Machine Learning in Mobile App Development.pdf
The Rise of AI and Machine Learning in Mobile App Development.pdfThe Rise of AI and Machine Learning in Mobile App Development.pdf
The Rise of AI and Machine Learning in Mobile App Development.pdf
Lilly Gracia
Minitool Partition Wizard Crack Free Download
Minitool Partition Wizard Crack Free DownloadMinitool Partition Wizard Crack Free Download
Minitool Partition Wizard Crack Free Download
v3r2eptd2q
How Biometric Attendance Systems Reduce Payroll Fraud & Costs?
How Biometric Attendance Systems Reduce Payroll Fraud & Costs?How Biometric Attendance Systems Reduce Payroll Fraud & Costs?
How Biometric Attendance Systems Reduce Payroll Fraud & Costs?
Star Link Communication Pvt Ltd
EASEUS Partition Master Crack with License Code [Latest]
EASEUS Partition Master Crack with License Code [Latest]EASEUS Partition Master Crack with License Code [Latest]
EASEUS Partition Master Crack with License Code [Latest]
bhagasufyan
SAP Document Compliance Overview -Imp document.pdf
SAP Document Compliance Overview -Imp document.pdfSAP Document Compliance Overview -Imp document.pdf
SAP Document Compliance Overview -Imp document.pdf
annapureddyn
Why Hire Python Developers? Key Benefits for Your Business
Why Hire Python Developers? Key Benefits for Your BusinessWhy Hire Python Developers? Key Benefits for Your Business
Why Hire Python Developers? Key Benefits for Your Business
Mypcot Infotech
Best Solution For Import and Export Contacts from VCF to CSV
Best Solution For Import and Export Contacts from VCF to CSVBest Solution For Import and Export Contacts from VCF to CSV
Best Solution For Import and Export Contacts from VCF to CSV
sung231
Metaverse Meetup: Explore Mulesoft MAC Project
Metaverse Meetup: Explore  Mulesoft MAC ProjectMetaverse Meetup: Explore  Mulesoft MAC Project
Metaverse Meetup: Explore Mulesoft MAC Project
GiulioPicchi
Odoo WooCommerce Connector, Multiple Woocommerce store connection
Odoo WooCommerce Connector,  Multiple Woocommerce store connectionOdoo WooCommerce Connector,  Multiple Woocommerce store connection
Odoo WooCommerce Connector, Multiple Woocommerce store connection
Aagam infotech
The evolution of Web Rendering Architectures
The evolution of Web Rendering ArchitecturesThe evolution of Web Rendering Architectures
The evolution of Web Rendering Architectures
Evangelia Mitsopoulou
How John started to like TDD (instead of hating it) - TED talk
How John started to like TDD (instead of hating it) - TED talkHow John started to like TDD (instead of hating it) - TED talk
How John started to like TDD (instead of hating it) - TED talk
Nacho Cougil
Alluxio Webinar | Whats New in Alluxio AI: 3X Faster Checkpoint File Creatio...
Alluxio Webinar | Whats New in Alluxio AI: 3X Faster Checkpoint File Creatio...Alluxio Webinar | Whats New in Alluxio AI: 3X Faster Checkpoint File Creatio...
Alluxio Webinar | Whats New in Alluxio AI: 3X Faster Checkpoint File Creatio...
Alluxio, Inc.
Online Software Testing Training Institute in Delhi Ncr
Online Software Testing Training Institute in Delhi NcrOnline Software Testing Training Institute in Delhi Ncr
Online Software Testing Training Institute in Delhi Ncr
Home
SketchUp Pro Crack [2025]-Free Download?
SketchUp Pro Crack [2025]-Free Download?SketchUp Pro Crack [2025]-Free Download?
SketchUp Pro Crack [2025]-Free Download?
kiran10101khan
A Brief Introduction About Raman Bhaumik
A Brief Introduction About Raman BhaumikA Brief Introduction About Raman Bhaumik
A Brief Introduction About Raman Bhaumik
Raman Bhaumik
The Role of Blockchain in Transparent & Secure Procurement.pptx
The Role of Blockchain in Transparent & Secure Procurement.pptxThe Role of Blockchain in Transparent & Secure Procurement.pptx
The Role of Blockchain in Transparent & Secure Procurement.pptx
asmith539880
Enscape Latest 2025 Crack Free Download
Enscape Latest 2025  Crack Free DownloadEnscape Latest 2025  Crack Free Download
Enscape Latest 2025 Crack Free Download
rnzu5cxw0y
Douwan Preactivated Plus Crack 2025-Latest
Douwan Preactivated Plus Crack 2025-LatestDouwan Preactivated Plus Crack 2025-Latest
Douwan Preactivated Plus Crack 2025-Latest
mubeen010khan

ATO 2014 - So You Think You Know 'Go'? The Go Programming Language

Editor's Notes

  • #2: What this presentation is about: Overview of language features, some personal perspective as a newcomer, current perspective NOT a talk on programming language theory NOT an advanced talk For people looking to learn about Go, answer should I use this language for my next project?
  • #5: Me: Looks kinda like a somewhat crippled C#/Modern C. Clean syntax, and gothreads/channels are nice. Now whats the syntax to declare an abstract class? Founders: Tried to create a simple language (get rid of the kruft in C++, that is well prepared for modern runtime environments (concurrency, networking, etc.) Procedural language (mostly), somewhat based on C/C++ Garbage collected Statically typed Compiles to native code Concurrency built-in at the lowest level
  • #6: So Ive heard a lot about how great Go is, tell me about all of the awesome features it has!
  • #7: Well. Go is actually a pretty simple language! Simple, purpose built to address programmer productivity issues experienced by Google in C++ projects Long builds, crazy dependencies (include hell) Programming language not adapted to take advantage of modern hardware (concurrency) Poor integrated tools to support the language Common errors in development (memory leaks, etc)
  • #8: When you download Go, you get way more than just the compiler/std libs: Go fmt - format code Go Get - fetch remote dependencies Go Test - integrated unit/benchmark testing Go Vet - check for common errors in code Go Doc - Generate code documentation from comments Go Fix - Help upgrade to new releases of Go (when syntax changes break builds - not much of an issue post v1.0) go tool pprof - help profile your Go Application 3rd Party: goimports - remove unused imports automatically (I have my IDE configure to do this on save) golint - another syntax checker, looks for code improvements jd - locked dependency manager (made by VividCortex)
  • #9: Go Creators have joked that Go was developed between C++ builds at Google. Not entirely untrue Large C++ codebase, build can take over an hour Even large Go projects can compile in seconds Reason is dependency management system (doesnt lead to recompiling dependencies over and over) Also much simpler language structure (syntax, paired down feature-set) Build time matters more than anything else - Rob Pike
  • #10: Memory Management is hard. C/C++, mem management left to programmer, bugs ensue Immediate design decision in Go - garbage collector
  • #11: Similar to C - if you declare an int you get and int (no worrying that your variable type is inferred correctly at runtime) Go also has type inference, but only at declaration Once you create it, you have to explicitly change a variables type
  • #12: Go has support for Objects - but we call them structs Objects can have methods just like classes in most OO languages can In fact, any type you create can have methods! i.e. type Name string can have method func (name Name) Introduce(){} Go has interfaces, but they do not have members, only functions Go does not have the traditional inheritance models in C++/Java We use Strong Ducktyping Any struct can inherit from an interface if it has the methods defined Standard lib structs can inherit your Interfaces!
  • #13: No talk about Go is complete without talking about Concurrency! Channels - send data between threads easily, asynchronously or synchronously GoRoutines - spin up another thread, just like that! Concurrency is a fundamental component of the language
  • #14: Heres a list (not all inclusive of course): Implicit numeric conversion (int != int32) Implements keyword (interface inheritance is implicit) No classes (declare structs/methods wherever, any data type can have methods) No constructor/destructors Function overloading (methods match by name, not signature) Pointer arithmetic (unsafe.Pointer exists though) Exceptions and try/catch (although we have panic/recover - for extreme cases) Generics
  • #15: Simple, productive language for modern hardware Fast Compilation Good tool support included Easy to pick up and understand Can hold the spec in your head No cruft/legacy support Start from scratch, dont try to fix C++
  • #17: The real world has concurrency - so heres a Hello World that showcases Gos concurrency model Create a concurrent thread just by prefixing a function with go Synchronize your threads with a blocking channel No Imports to access concurrency - they are built right into the language.
  • #18: And theres our output (Pirate Slang!)
  • #19: To be fair, Hello World isnt really a real world scenario. Lets make a simple web-server, thats a little better!
  • #20: Do a live demo on your local machine, or just go over the code in the Playground (dont hit run in the playground!)
  • #21: A static website server that looks in a single location and responds to requests with the file there. 1 line.
  • #22: Unlimited concurrency can be dangerous (DDOS?) Lets see a server that limits the number of concurrent connections This code uses channels to do just that
  • #23: Go has a couple of things that can be quite annoying at times
  • #24: Heres a program, what will its output be? Why doesnt it think there is a bomb? thereIsABomb was actually declared twice! once outside the for-loop and once inside. We change the value of the one that then loses scope, so thereIsABomb is always checked as false. This is a tricky problem that occurs due to Gos flexible variable declaration syntax Even the creators have said they dislike it as it is Can it be fixed? Maybe make go vet warn?
  • #25: So what else is interesting, problematic and/or weird about Go?
  • #26: Go doesnt have generics One of the most criticized points Considered the biggest feature-screwups (why didnt they include it!?) by a lot of people Most asked-for feature (to my knowledge) Initially I thought this was a pretty big drawback A Couple Things: I havent needed Generics since I switched to Go In fact, I didnt really use them a lot anyways when I had them Did I ever really need them? Im not so sure Generics are complicated Significant increase in language complexity to add them in all liklihood Compile times will increase The Go Developers are not blatantly against them Have said they would add if a good solution or blatant problem was brought forward So far none has AFAIK Go Mentality: Smallest possible featureset we can be productive with Its okay if we have to copy some code as a result Productivity is higher priority than hyper-elegant code
  • #27: Builtin Types - complex64 and complex128 Builtin functions - real() and imag() to get the components math/cmplx package to manipulate them
  • #28: When you declare a variable, thats it. Want to treat it as something else? Cast it. int and int32 are different, have to cast to add them (note constants can be added to any numeric type - they are typeless) I thought this sucked when I started using Go What do you mean I cant just add this byte to an int!? Are you kidding me? Luckily, I could usually just change the types interacting and the code got cleaner Why would they do this though? It makes every expression explicit (i.e. I am specifically choosing to mix these types, as I believe it is okay) Reduces the chance of accidental scope issues (overflow, ect.) Absolutely no ambiguity as to how types interact together (is it safe to mix these?) Annoying? Sure, but not a deal breaker
  • #29: go fmt - it formats your code, the Go way only If you are the guy on the left (like I was), this will make your brain itch Wont even compile when you have bracket on its own line So why cant I use my own style? Simplicity (a minor case, I know) Universally formatted code, no matter where you go Lends to readability Google has solved the style debate in Go (we have more important things to do as engineers)
  • #30: I agree that unused vars/imports should be errors, but picture if you will: Hacking on a feature, want to print a value as a sanity check go add fmt to imports declare the var, add a print statement It works! Lets move on: Delete print statement, add some more code Build fails - unused import remove import Build fails - unused variable delete var What was I doing again??? GoImports helps, but requires a mindset change (quick hacks no longer quick, I guess) This still trips me up, but less as time goes on
  • #31: Go supports concurrency very easily, but race conditions are still a problem builtin sync package has mutexes As always, be careful when sharing data across threads!
  • #32: Why does a language whose creators specifically wanted simplicity and eliminate errors include the goto statement? Lets all agree - the next popular language will not have goto - this madness must end.
  • #33: Heres something fun: Easter Eggs! These keywords really exist - you can use them anywhere in a Go Program (the compiler simply ignores them all) go fmt will not understand them though