Discover Packages
github.com/repenno/interview
module
Version:
v0.0.0-...-1be5213
Opens a new window with list of versions in this module.
Published: Aug 8, 2020
License: Apache-2.0
Opens a new window with license information.
README
README
¶
Go Programming Gems and Classic Problems
The goal is to compile hidden gems and off-the-beaten path Go features and patterns. This is not meant to be a library or reference implementation.
Gems and Off-the-beaten Path
closures
A dramatic example of Go Closures. A two-level closure pattern.
composite_literals
It is important to understand what composite literals mean in Go through some interesting use-cases
for_with_label
For loops can have break and continue statements with labels . This is a useful but less well-known feature.
runes_bytes_loops
A must-understand for serious programmers. Simple program demonstrating tricky concepts . Do you know that 'a' is a int32, str[0] is a uint8, the value of position 0 in a range loop is a rune?
slice_gotchas
Do you know that this does not cause an out of bounds error?
c := make([]int, 3)
fmt.Println(c[len(c):len(c)])
slice_tricks
Implementation of simple functions that demonstrate interesting slice operations such as extending, expanding and inserting elements.
strings_in_depth
Let's look under the hood and see how strings are represented in Go and print a string by walking the memory addresses, C-style.
variadic_functions
Variadic functions in Go are certainly off-the-beaten path. One hidden gem is interface{} variadic functions
Classic Problems
Expand ▾
Collapse ▴
Directories
¶
Click to show internal directories.
Click to hide internal directories.