This repository has the material for the "Let's Learn Go" Workshop.
We will use the Go Playground to run the exercises. In case there are internet issues, we recommend you to download the CheatSheet and the exercises prior to the session. You can also install the Go binary to run it in your computer (see details in the CheatSheet).
This is the list of playgrounds we will use during the session.
-
hello: https://play.golang.org
-
Exercise 1: Create a Message
- Exercise: https://play.golang.org/p/uFC-kWD5RJM
- Solution: https://play.golang.org/p/UBK4AK4Qcuf
-
Exercise 2: Encapsulate the print into a function
- Exercise: https://play.golang.org/p/y7ZyoOxRZAj
- Solution: https://play.golang.org/p/_4h5Bj4wEPY
-
Exercise 3: Make it a function of the type
- Exercise: https://play.golang.org/p/5mZ6emMNQdx
- Solution: https://play.golang.org/p/fXxa8qu-Z53
-
Exercise 4: Add a function that creates a Message
- Exercise: https://play.golang.org/p/vcVyQVvZdui
- Hint: https://play.golang.org/p/pOCunRuYYZP
- Solution: https://play.golang.org/p/Q3vsjBY2qZp
-
Exercise 5: Validate that the message is not empty
- Note: explain interfaces with this
- Exercise: https://play.golang.org/p/GHzlVApSU0t
- Hint: https://play.golang.org/p/k0j_pZnKS4w
- Hint2: https://play.golang.org/p/uA_3gfa1Dr9
- Solution: https://play.golang.org/p/Sl_MgyBZNB8
-
Exercise 6: List of Messages (Array & Loop)
- Exercise: https://play.golang.org/p/weXQReIJPU7
- Solution a: https://play.golang.org/p/X66FIwauyXl
- Exercise b: use two loops, one to create messages, another to print them.
- Solution b: https://play.golang.org/p/283grJuzJ1Z
- Exercise c: extract the loops to functions
- Solution c: https://play.golang.org/p/RHRTN-NxuTx
-
Exercise 7 (Extra): Add number to identify order
- Exercise: https://play.golang.org/p/vuF6Q0D7rhl
- Solution: https://play.golang.org/p/5F-tIzEAGI7
-
Exercise 8 (Extra): Add boolean to know if it's the last and print that (If)
- Exercise: https://play.golang.org/p/BxhVaTDUGI_T
- Half solution: https://play.golang.org/p/DHp5-f6IW8N
- Solution (break the loop): https://play.golang.org/p/BANYFOeOOvJ
-
Exercise 9: Write messages to a channel instead of a list.
- Exercide: https://play.golang.org/p/GD_H3wN7_RM
- Solution (spot the problem): https://play.golang.org/p/5mrtCVIExuT
-
Exercise 10: How to ensure program doesn't quit before printing all messages
- Exercise: https://play.golang.org/p/b8hXBoOA2ya
- Solution: https://play.golang.org/p/YjENh5ULfIV
-
Exercise 11: Test the producer
- Exercise: https://play.golang.org/p/ZTG0MM1GNGw
- Solution: https://play.golang.org/p/hqI_xM5DAHo