Course / The terminal and the language
Run it, then build it
How to fetch and submit this lab
Once: install the tool and connect your account.
curl -fsSL https://gonomicon.com/install.sh | sh
gonomicon loginEach lab: download it, edit the file named in the instructions, then submit.
gonomicon fetch week-1/07-02-build-the-executable
cd 07-02-build-the-executable
gonomicon submitGoal
Write a program that prints exactly:
Learning Go, one program at a time!
This lab checks something extra: that go run and a binary built with
go build produce identical output, since they're compiling and running the
exact same source file.
Where to write it
Edit main.go.
Checking your work
go run .
go build -o app .
./app
Both should print the same line. Then run the test:
go test ./...
Run it
gonomicon fetch week-1/07-02-build-the-executable
cd 07-02-build-the-executable
gonomicon test
gonomicon submit
Hints
- go run compiles and runs in one step; go build only compiles, producing a file you run yourself.
- Both commands compile the exact same source, so their output should match exactly.