Tiny CLI Capstone
Part of the Go course
Up to now every program you have written has had its inputs baked into the source. If you wanted to add different numbers, you edited the file and ran it again. That is fine for learning and useless for a tool, because a tool is something you hand to somebody else and they decide what it works on.
This lesson builds a real one: a program you run as sum 1 2 3 and that prints 6. It is small on purpose, because the interesting part is not the arithmetic. It is everything around it. Getting values in from outside, deciding what to do when those values are nonsense, telling the person who ran you that something went wrong, and turning the whole thing into a single file you can copy onto another machine.
Want to learn Go Tiny CLI Capstone in a real environment?
Click below, get a fresh Linux box with Go ready to go, and work through Tiny CLI Capstone hands-on with an AI tutor that knows your code.
Start this lessonTiny CLI CapstoneWhat you'll learn
- Os.Args
- Strconv.Atoi
- Error handling with if err != nil
- Os.Exit
- Go build
- Putting it together
