Go R1 Day 55
In Go, when you call a function or a method the arguments are copied. 1
- Built some test cases for working with pointers and test methods.
- Did this in Goland to become more familar with it and figured out how to use the nice tests explorer with a floating window to auto-test.
- Built a filewatcher configuration watcher as alternative to tests panel, allowing automated run in terminal or output panel of
go test ./....
- Couldn’t figure out how to run every test in project, as it’s a multi-module repo (for tutorials). VSCode works fine with this with the multi-module support.
These pointers to structs even have their own name: struct pointers and they are automatically dereferenced. 1
This explains something that felt a little confusing as a new Gopher. Now I know why returning a value back as an int didn’t require explicit dereferencing. 2
Not clear yet on if I need to set the
is := New(t) in the context of each
t.Run() or not.