0% found this document useful (0 votes)
17 views

Lightning Go

The document introduces the Go programming language, including that it was invented by Rob Pike and Ken Thompson. It discusses Go's features like speed and garbage collection while retaining expressiveness. Go has a nice development environment with tools for building, compiling and getting libraries. It supports concurrency with goroutines and channels and allows code to run everywhere through cross-compilation. Object orientation is supported through types, interfaces and embedding without inheritance. Learning resources are also provided.

Uploaded by

felixhahn721
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Lightning Go

The document introduces the Go programming language, including that it was invented by Rob Pike and Ken Thompson. It discusses Go's features like speed and garbage collection while retaining expressiveness. Go has a nice development environment with tools for building, compiling and getting libraries. It supports concurrency with goroutines and channels and allows code to run everywhere through cross-compilation. Object orientation is supported through types, interfaces and embedding without inheritance. Learning resources are also provided.

Uploaded by

felixhahn721
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Getting started with Go

Ben Jones

12/06/2023 #golang 2
Language invented by:

Rob Pike Ken Thompson

12/06/2023 #golang 3
Rob Pike wrote books like…

12/06/2023 #golang 4
Ken Thompson wrote operating
systems like…

12/06/2023 #golang 5
All the cool new stuff is go...

12/06/2023 #golang 6
golang features
• Keep most of expressiveness of dynamic
languages, gain speed
• C-like, statically linked, garbage collected
• Fast compilation
• Nice build / compile tools
• A reaction to C++ but won converts from
python/ruby devs

12/06/2023 #golang 7
Nice dev environment
• go get libraries

$ go get github.com/mefellows/muxy
$ ls $GOPATH/src/github.com/mefellows/muxy
LICENSE README.md examples main.go
muxy scripts version.go Makefile
command log middleware protocol
symptom wercker.yml

12/06/2023 #golang 8
No unused stuff

http://tour.golang.org
http://play.golang.org

12/06/2023 #golang 9
Run everywhere
• X-Compile is trivial
$ GOOS=windows GOARCH=386 go build -o egroupexpand.exe
egroupexpand.go
$ ls -l
total 19344
-rwxr-xr-x 1 ben staff 5445348 Aug 27 10:33 egroupexpand
-rwxr-xr-x 1 ben staff 4449792 Sep 29 10:44
egroupexpand.exe
-rw-r--r-- 1 ben staff 3075 Aug 27 10:33 egroupexpand.go

• No worrying about dependency versions:


[bejones@aiadm060 ~]$ python -V
Python 2.6.6

12/06/2023 #golang 10
OO without loads of cruft
• types and values instead of classes and
objects
• methods on any user-defined type
• polymorphism with interfaces
• namespacing with exports
• no inheritance
• can extend types by embedding

12/06/2023 #golang 11
Concurrency
• concurrency not parallelism (though
GOMAXPROCS can help with latter)
• “Do not communicate by sharing memory;
instead share memory by communicating”
• Goroutines: function executing concurrently
with other goroutines in same address
space
• created by prefixing func or method call with “go”
• Channels - pipes that connect goroutines

12/06/2023 #golang 12
learning resources
• http://tour.golang.org
• https://golang.org/doc/effective_go.html
• https://golang-for-python-programmers.readt
hedocs.org/en/latest
/
• http://blog.golang.org/concurrency-is-not-
parallelism
• http://www.youtube.com/watch?v=
jgVhBThJdXc
• https://www.golang-book.com
12/06/2023 #golang 13

You might also like