UNO Reckons You Can’t Stack +2 Cards And The Internet Is NOT Having It 1 minute read. Virgin Australia Serves Up 2-Minute Noodles In Business Class. Golang Cheat Sheet by deleted via cheatography.com/23330/cs/5127/ Control structures If func main // Basic one if x 0 return x.
Getting started
Introduction
- A tour of Go(tour.golang.org)
- Go repl(repl.it)
- Golang wiki(github.com)
The AP Psychology Ch. 11,12,14 Cheat Sheet was released by MelissaM021004 on Cheatography. Here's how they described it: Here's how they described it: Cheatsheet for chapters 11,12, and 14.
JQuery 1.5 Visual Cheat Sheet by Antonio Lupetti pdf (woorkup.com) jQuery 1.3 Visual Cheat Sheet by Antonio Lupetti (WOORK) pdf (woork.blogspot.com) Beginner’s essential jQuery Cheat Sheet by Robert Mening pdf, png (websitesetup.org) jQuery 1.2 Cheat Sheet pdf, png, bw pdf, bw png (labs.colorcharge.com) jQuery 1.2 by Adrien Gibrat pdf. 2020 popular 1 trends in Education & Office Supplies, Memo Pads, Home & Garden, Painting & Calligraphy with Cheat Sheet and 1. Discover over 114 of our best selection of 1 on AliExpress.com with top-selling 1 brands. Shop the top 25 most popular 1 at the best prices!
Hello world
hello.go
Or try it out in the Go repl, or A Tour of Go.
Variables
Variable declaration
Shortcut of above (Infers type)
Constants
Constants can be character, string, boolean, or numeric values.
See: Constants
Basic types
Strings
Strings are of type
string
.Numbers
Typical types
Other types
Arrays
Arrays have a fixed size.
Slices
Slices have a dynamic size, unlike arrays.
Pointers
Pointers point to a memory location of a variable. Go is fully garbage-collected.
See: Pointers
Type conversions
See: Type conversions
![Sheet Sheet](https://www.300hours.com/uploads/1/2/2/3/12234663/1489262_orig.png?0)
Flow control
Conditional
See: If
Statements in if
A condition in an
if
statement can be preceded with a statement before a ;
. Variables declared by the statement are only in scope until the end of the if
.See: If with a short statement
Switch
See: Switch
For loop
See: For loops
For-Range loop
See: For-Range loops
Functions
Lambdas
Functions are first class objects.
Multiple return types
Named return values
By defining the return value names in the signature, a
return
(no args) will return variables with those names.See: Named return values Recovery files.
Packages
Importing
Both are the same.
See: Importing
Aliases
Exporting names
Algebra 2 Cheat Sheet Pdf
Exported names begin with capital letters.
See: Exported names
Packages
Every package file has to start with
package
.Concurrency
Goroutines
Channels are concurrency-safe communication objects, used in goroutines.
See: Goroutines, Channels
Buffered channels
Buffered channels limit the amount of messages it can keep.
See: Buffered channels
Closing channels
Closes a channel
Iterates across a channel until its closed
Closed if ok false
See: Range and close
WaitGroup
A WaitGroup waits for a collection of goroutines to finish. The main goroutine calls Add to set the number of goroutines to wait for. The goroutine calls
wg.Done()
when it finishes.See: WaitGroupError control
Defer
Algebra 2 Cheat Sheet
Defers running a function until the surrounding function returns.The arguments are evaluated immediately, but the function call is not ran until later.
See: Defer, panic and recover
Deferring functions
Lambdas are better suited for defer blocks.
The defer func uses current value of d, unless we use a pointer to get final value at end of main.
Structs
Defining
See: Structs
Literals
You can also put field names.
Pointers to structs
Doing
v.X
is the same as doing (*v).X
, when v
is a pointer.Methods
Receivers
There are no classes, but you can define functions with receivers.
See: Methods
Mutation
By defining your receiver as a pointer (
*Vertex
), you can do mutations.See: Pointer receivers
Interfaces
A basic interface
Struct
Struct
Rectangle
implicitly implements interface Shape
by implementing all of its methods.Methods
The methods defined in
Shape
are implemented in Rectangle
.Interface example
References
Official resources
- A tour of Go(tour.golang.org)
- Golang wiki(github.com)
- Effective Go(golang.org)
Other links
- Go by Example(gobyexample.com)
- Awesome Go(awesome-go.com)
- JustForFunc Youtube(youtube.com)
- Style Guide(github.com)