0% found this document useful (0 votes)
50 views14 pages

GoLang Overview: History & Features

Uploaded by

Đức La Minh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views14 pages

GoLang Overview: History & Features

Uploaded by

Đức La Minh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

GoLang

Learning
La Minh Duc
SUMMARY
 GoLang History
 GoLang Properties
 Hello, World
 Multiple return values
 Named result parameters
 Defer
 Go Slices
 Concurrency
 Goroutine
 Channel

2
GOLANG HISTORY
 Conceived in September 2007 by Robert Griesemer, Rob Pike and Ken Thompson at Google
 Was announced in November 2009
 Was built for multicore and network era
 Goals:
 Efficient in compilation and execution
 Reliable and robust programs

3
GOLANG PROPERTIES
+
 Fast compilation, small execution time
 Binary file
 Easy to cross compile
 Readability and usability
 High performance in multiprocessing, networking
 Automatic memory management (garbage collection)
 No forward declarations and no header files
 Built in concurrency support
 Go runtime are compiled and combined with go application

4
GOLANG PROPERTIES
-
 Large binary file
 Missing generic type

5
HELLO, WORLD

6
MULTIPLE RETURN VALUES
 Functions in Go can return multiple values

7
NAMED RESULT PARAMETERS
 The results of a Go function can be given names and used as regular variables

8
DEFER
 defer statement schedules a function call to the end of the main function

 Guarantee that we will never forget to close a file (when we add another return)
 The close sits near the open (clearer)
9
GO SLICES
 Wrap arrays to give a better interface to work with
 Slices hold references to an underlying array
 Length and capacity
 Array: len = cap
 Go Slices: len <= cap

10
CONCURRENCY
Goroutine
 Lightweigh than thread (goroutine 2KB vs thread 1~2MB)
 Managed by go runtime
 Has its own stack
 Run concurrently

11
CONCURRENCY
Channel
 Communicate between goroutines
 Synchronize task between goroutines
 Can be buffered

12
 Test, mock
 Package management
 Dependencies Injection
 Select, channel, goroutine

13
THANKS FOR YOUR ATTENTION

14

You might also like