0xBF
0xBF

0xBF

Follow
homeSeriesOpen Source License
Series

Go Cheatsheet


Articles in this series

Go cheatsheet - Slice Utilities

Apr 19, 20212 min read

Slice Empty a slice a := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} a = a[:0] // or a = nil Prepend b := []int{2, 3, 4} b = append([]int{1},...

Go cheatsheet - Slice Utilities

Go cheatsheet - Env

Apr 20, 20211 min read

Env Functions to operate environment variables: os.Getenv: get env variable by name, if not set, return empty string os.LookupEnv: return (value,...

Go cheatsheet - Env

Go cheatsheet - Flag

Apr 20, 20211 min read

Flag package main import ( "flag" "fmt" ) func main() { count := flag.Int("count", 0, "run time count") prefix :=...

Go cheatsheet - Flag

Go cheatsheet - String to Number

Apr 21, 20211 min read

String to Number Atoi k, _ := strconv.Atoi("135") // k = 135 n, e := strconv.Atoi("wat") // n = 0, e is not nil ParseInt i, _ :=...

Go cheatsheet - String to Number

Go Cheatsheet - Get User Input from Stdin

Apr 21, 20211 min read

Get User Input from Stdin Scanln & Scanf var name string fmt.Scanln(&name) // this will scan only one string token (if there is a space in your...

Go Cheatsheet - Get User Input from Stdin

Go Cheatsheet - base64,32,58 encoding

Apr 21, 20211 min read

base64,32,58 encoding base64 Standard Encoding/Decoding import ( "encoding/base64" "fmt" ) func main() { data := []byte("test data") ...

Go Cheatsheet - base64,32,58 encoding