This repository contains some exercises for the introductory level of the Friends of Go workshops.
Feel free to open a new PR with your solutions.
The exercises' level is incremental, so to avoid confusion, just do the exercises in a sorted way:
exercise-1
exercise-2
exercise-3
exercise-4
Each exercise has a its own README.md
file with the specific instructions and some notes.
Feel free to open a new PR to contribute with us (typos, missing info, etc).
This repository is tested under Go 1.12+ and using Go Modules.
The dependencies needed are:
-
$ go get -u golang.org/x/tools/cmd/benchcmp
-
See the installation details for each platform on the link.
1. Swapping Numbers
The first exercise basically consists on implementing a function to swap numbers:
func Nums(nums []int) []int {
// TODO: Swap numbers
return nums
}
2. Stupid Cache
The second exercise let you do your own implementation of an stupid cache to satisfy the given cache interface:
type StupidCache interface {
Get(key string) []byte
Set(key string, data []byte)
}
3. Benchmarking & Profiling
The third exercise is focused on benchmarking and profiling the Marshal
and Unmarshal
functions of
the encoding/json
package.
4. Concurrent Quiz
This fourth (and the last) exercise consists on adding concurrency on a quiz simple application in order to extend it and make it more funny.
It has has some "bonus tracks" to make it even funnier.