A simple repository for documenting and learning the basic functionality of go
. The repository is simple,
each module contains a main.go
and the entrypoint to that module is the Run
method. Creating multiple
main
functions in each package is not viable. The main.go
in the root directory synchronously calls
all the examples Run
functions sequentially in line with the table of contents below.
All modules are exposed under the -module
flag. To run a particular exercise, take the top level folder name
and run it like so:
# To run the `closingchannels` examples.
go run . -module closingchannels
- 01 - Hello World
- 02 - Values
- 03 - Variables
- 04 - Constants
- 05 - For
- 06 - If, else if and else
- 07 - Switch
- 08 - Arrays
- 09 - Slices
- 10 - Maps
- 11 - Range
- 12 - Functions
- 13 - Variadic Functions
- 14 - Closures
- 15 - Recursion
- 16 - Pointers
- 17 - Strings & Runes
- 18 - Structs
- 19 - Methods
- 20 - Interfaces
- 21 - Struct Embedding
- 22 - Generics
- 23 - Errors
- 24 - Goroutines
- 25 - Channels
- 26 - Buffered Channels
- 27 - Channel Synchronisation
- 28 - Channel Directions
- 29 - Selects
- 30 - Timeouts
- 31 - Non Blocking Channel Operations
- 32 - Closing Channels
- 33 - Range Over Channels
- 34 - Timers
- 35 - Tickers
- 36 - Worker Pools
- 37 - Waitgroups
- 38 - Rate Limiting
- 39 - Atomic Counters
- 40 - Mutexes
- 41 - Stateful Goroutines
- 42 - Sorting
- 43 - Custom Comparator Functions
- 44 - Panic
- 45 - Defer
- 46 - Recover
- 47 - String Functions
- 48 - String Formatting
- 49 - Text Templating
- 50 - Regexp
- 51 - Json
- 52 - Xml
- 53 - Time
- 54 - Epoch
- 55 - Time Formatting
- 56 - Random Numbers
- 57 - Number Parsing
- 58 - URL Parsing
- 59 - SHA256 Parsing
- 60 - Base64 Encoding
- 61 - Reading Files
- 62 - Writing Files
- 63 - Line Filters
- 64 - File Paths
- 65 - Directories
- 66 - Temporary Files & Directories
- 67 - Embed Directive
- 68 - Testing & Benchmarking
- 69 - Command Line Arguments
- 70 - Command Line Flags
- 71 - Command Line Subcommands
- 72 - Environment Vars
- 73 - Logging
- 74 - HTTP Client
- 75 - HTTP Server
- 76 - Contexts
- 77 - Spawning Processes
- 78 - Execing Processes
- 79 - Signals
- 80 - Exit
- 81 - ErrGroup
- 82 - Pointer Vs Value Receiver