📘️ Learn Go by fixing tiny incorrect programs
This project was directly inspired by the great ziglings project which itself was inspired by rustlings.
For a first time learner it is suggested you complement this material with another source such as
- Go by example. A lot of material here is based on this project!
- Go go-to guide by yourbasic. Great source for beginners.
These exercises will probably be difficult if you've never programmed before.
The exercises should be self-contained and self-explained, though this is a WIP and suggestions are welcome!
Requires a Go installation to run the examples.
-
Download the repository (or alternatively clone it)
-
Install the VSCode Go extension authored by Go Team at Google
-
Open the
gopherlings
folder in VSCode -
Navigate to the exercise file, i.e.
exercises/001-hello/hello.go
-
Once the
hello.go
file is open you may edit it and press F5 to run it. Output will be shown in the Debug Console.
-
Clone repository
git clone https://github.com/soypat/gopherlings.git
-
Navigate to example's directory
cd gopherlings/exercises/001-hello
-
Edit the file so it is correct and run it with
go run
go run hello.go
Optionally, instead of step 3, use
gopherlings watch
to auto reload your code after you save your code. Then you will see your code output without any action. You can simply focus on your code.go install github.com/soypat/gopherlings/cmd/gopherlings@latest gopherlings watch gopherlings help # To see other commands
Note: You need to define your
GOBIN
environment variable before runninggo install
and add it to yourPATH
.GOBIN
specifies the directory to which go binaries are installed to.
- Add quizzes after
$n$ exercises.- Possibly add several quizzes of varying difficulty inside quiz directory.
- Improve the helper program.
- A
hint
subcommand or interactive hints during thewatch
command. - Allow
run
to take an argument that runs a specific exercise. - Add a subcommand to run all exercises and check them against expected output.
- Catch errors that prevent the helper from running exercises (like an incomplete Go installation).
- A
- Have exercises that cover the entire Go spec.