❮ Index
❯
TOC: Golang
- Introduction to Golang
- Basics
- Hello Foo - Println
- Hello Bar - Printf
- Hello Bar - Printf %v
- Enforce variables types
- Basic Types
- Show inferred variable type - Printf %T
- Show type of variable - reflect.TypeOf
- get variable type - %T or reflect.TypeOf
- Variable declaration (var)
- Default values of variables
- Scan input strings from STDIN
- if else statement
- Converting string to integer - strconv, Atoi
- Error Handling
- Converting string to integer with error handling - strconv, Itoa
- Converting string to float - strconv, ParseFloat
- Converting integer to string - strconv, Itoa
- Scan STDIN convert to number
- Comments
- Exercise: circle STDIN
- Exercise: rectangular STDIN
- Exercise: calculator STDIN
- Solution: circle STDIN
- Solution: circle STDIN with math
- Solution: rectangular STDIN
- Solution: calculator STDIN
- Solution: calculator STDIN switch
- CLI
- Skeleton
- Numbers
- Integer-based operations
- Floating-point based operations
- Precision
- Mixed operations
- int8
- uint8
- Bytes
- Byte is uint8
- uint16
- uint32
- Converting values to other types - float32, int, string
- Complex numbers
- binary - octal - hex
- Random
- Random with seed
- Exercise: One-dimensional spacefight - level 1
- Solution: One-dimensiona spacefight - level 1
- Boolean - Logical operators
- Loops
- 3-part for loop
- while-like for loop
- infinite loop
- break out from loop
- continue
- loop on two variables
- break out from internal loop (labels)
- Exercise: One-dimensional spacefight
- Exercise: FizzBuzz
- Solution: One-dimensional spacefight - multiple guesses till hit
- Solution: One-dimensional spacefight - allow x
- Solution: One-dimensional spacefight - allow m
- Solution: FizzBuzz
- Strings
- Single and double quotes
- Runes
- Strings
- Change string
- Strings and Runes
- Length of string
- iterate over characters in a string
- String Contains, HasPrefix, HasSuffix
- Split
- Join
- Split on whitespaces
- Newlines
- Read line from stdin (keyboard)
- Read line from stdin (keyboard) with error handling
- Trim line - remove trailing newline from string
- Strings and bytes
- Scan in a loop
- Compare strings
- Raw strings
- Multiline strings
- Exercise: how long is this string?
- Exercise: which string is longer?
- Exercise: which string is ahead in ABC?
- Exercise: which string is ahead - menu
- Exercise: Hide substring
- Solution: how long is this string?
- Solution: which string is longer?
- Solution: which string is ahead in ABC?
- Solution: which string is ahead - menu
- Solution: Hide substring
- Arrays
- Arrays
- Array index out of range - compile time
- Array index out of range - run time
- Array change value
- Arrays automatic length
- Array: empty and fill
- Empty array of strings
- Array assignment (copy)
- Array assignment (pointer)
- Matrix (two dimensional array)
- For loop on array - iterate over array
- for loop on values of array (no index)
- Arrays conclusion
- Exercise: Language Selector
- Exercise: count digits
- Exercise: count digits from string
- Exercise: Report statistics
- Solution: Language Selector
- Solution: count digits
- Solution: count digits from string
- Solution: Report statistics
- Variables
- Constants
- Functions
- Hello World function
- Hello You function (passing parameter)
- Function with multiple parameters
- Function with return value
- Multiple return values
- Returning an error from a functions
- Named return parameters
- Passing a function as a parameter - Callback function
- Callback function with one parameter
- Anonymous functions
- Anonymous functions assigned to name
- Numbers are passed by value
- Function Overloading - Multiple function with the same name
- Defer
- Defer early returns
- Deferred cd in a function
- Defer in if-statements
- Defer and parameters
- Exercise: Fibonacci
- Exercise: Defer remove temporary directory
- Exercise: FizzBuzz in function
- Exercise: ROT13
- Solution: FizzBuzz in function
- Solution: ROT13
- Slices
- Slice of an array
- Slice
- Change value in slice
- Slice Assign
- Slice of a slice
- Append to a slice
- Slice append
- Remove last element of slice (pop)
- Remove first element of slice (shift, pop(0))
- Pre-allocate capacity for slice with make
- For loop in slice - iterate over slice
- for loop on values of slice (no index)
- Merge two slices
- Find element in array or slice
- Remove element of slice
- Weird merge slices
- Sort slice
- Are values sorted?
- Sort strings by length
- Sort strings by length and then abc order
- Search in slice
- Variadic function (arbitrary number of parameters)
- Defer and slice
- Exercise: count words
- Exercise: Create a list of words from sentences
- Exercise: Create a unique list of values
- Exercise: Reverse Polish Calculator
- Exercise: DNA Sequencing
- Solution: count words
- Solution: Create a list of words from sentences
- Solution: Create a unique list of values
- Solution: Reverse Polish Calculator
- Solution: DNA Sequencing
- Solution: DNA Sequencing with in place filter
- Files
- Read file line-by-line with Scanner
- Read file line by line with Reader
- Read file as one string (slurp)
- Write to file
- Write number to file
- Append to file
- Reading CSV file
- Exercise: Sum of numbers in a file
- Exercise: Count number of digitis
- Exercise: ROT13 on file
- Exercise: Selector with list of items from a file
- TODO: Solution: Sum of numbers in a file
- Maps
- Map (hash, dictionary)
- Empty Map
- Empty Map with make
- Map type defintion without container
- Create map with data in it already
- Delete Map element
- Size of map (len)
- Access map element (that does not exist)
- Map element exists
- Increment map elements
- Iterate over elements of map
- Keys of a map
- Sort map
- Sort map by value
- map of slices
- Mixed map
- Exercise: count characters
- Exercise: count characters - sort by frequency
- Exercise: count words
- Exercise: count words from file
- Solution: count characters
- Solution: count characters - sort by frequency
- Solution: count words
- Solution: count words from file
- Testing
- Struct
- Struct and type
- Struct with partial information (default values)
- Slice of structs
- Anonymous struct
- Struct in a struct
- composition via embedding instead of inheritance
- Tags and introspection (reflect)
- use cleanenv
- methods
- method of int
- map keys method
- method gets copy of struct
- method pass pointer of struct
- Exercise: read-csv-struct
- Exercise: implement 2D point and move
- Exercise: implement 3D point and move
- Exercise: implement wc
- Solution: implement wc
- Logging
- Time
- Pointers
- Panic (Exception handling)
- Goroutine
- Without goroutine
- goroutine example
- goroutine not finished yet
- goroutine no wait
- Global waitgroup for goroutines
- Wait for goroutines
- Return data from goroutines
- Counter - shared variable
- Mutex
- Channels
- Channels are blocking
- Channel capacity - buffered channel
- Channel with loop
- Pipeline map
- Pipeline filter
- TODO: Pipelines
- Fibonacci goroutine
- Loop from a channel
- Select channel
- Delayed start
- Job pool
- Check for race conditions
- Stand alone web application
- Maximum processes
- Exercise: Collect data from urls
- Exercise: Process multiple CSV files
- Exercise: counter with lock
- Exercise: Fibonacci in parallel
- Solution: Collect data from urls
- Functions 2
- Numbers passed by reference
- Array passed by value or by reference
- TODO: pass by value, pass by reference
- Variable declaration outside of functions
- Exercise: Fibonacci series
- Exercise: Permutations
- Exercise: 100 doors
- Solution: Fibonacci series
- Solution: Fibonacci recursive
- Solution: single counter
- Solution: Permutations
- Solution: 100 doors
- TODO return array
- Bitwise
- Formatting
- Filesystem
- Regular Expressions (Regexes, Regexp)
- Flow Control
- JSON
- Web client
- HTTP Server
- External programs
- Distribution
- Command line arguments (Flag)
- Appendix
- Some advanced topics
- Resources
- Caller filename
- os.Executable
- Solution: rectangular (STDIN) Reader
- Scan int
- Function assignment
- Overwriting built-in functions
- TODO: stack
- queue
- Left over
- Open Web browser
- Unicode
- golang create io.reader from string
- Parse HTML Token by token
- Parse HTML extract tags and attributes
- Other slides