Skip to content

About

golang version of rustlings to help golang beginner learn the syntax of golang

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gorustlings

Small Rustlings-style exercise runner for learning Go. No external dependencies — everything is stdlib, so go run . works right after cloning.

Each exercise lives in its own package under exercises/<topic>/<name>/ and comes with:

  • a starter .go file with a bug, a blank function, or a missing implementation, marked // I AM NOT DONE at the top
  • a _test.go file you're not meant to edit, which defines what "correct" means

Usage

go run . run              # check exercises in order, stop at the first
                           # one that needs work (default with no args)
go run . watch             # like run, but re-checks automatically every
                           # time you save a file
go run . list               # show every exercise and its status
go run . hint <name>        # print a hint for one exercise
go run . solution <name>    # print a reference solution for one exercise

or build a binary once: go build -o gorustlings . and run ./gorustlings ....

Workflow

  1. Run go run . watch (or go run . run and re-run by hand).
  2. It stops at the first exercise that either fails its tests or still has the // I AM NOT DONE marker.
  3. Open the file it points you to (e.g. exercises/01_variables/variables1/variables1.go), fix the code.
  4. Once its test passes, delete the // I AM NOT DONE line at the top of the file to mark it complete and move on.
  5. Stuck? go run . hint <name>. Really stuck? go run . solution <name>.

Topics covered

# Topic Exercise
00 intro hello
01 variables variables1
02 types & conversion types1
03 functions functions1
04 control flow if1
05 slices slices1
06 maps maps1
07 structs & methods structs1
08 pointers pointers1
09 interfaces interfaces1
10 errors errors1
11 closures closures1
12 goroutines & channels goroutines1

Adding your own exercises

  1. Create exercises/<NN>_topic/<name>/ with a starter .go file (start it with // I AM NOT DONE) and a _test.go file.
  2. Add an entry to the exercises slice in info.go with the package directory, student file name, a hint, and a reference solution.
  3. go run . list should pick it up automatically.

About

golang version of rustlings to help golang beginner learn the syntax of golang

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages