/calculator

Example calculator written in golang - tutorial result

Primary LanguageGo

Golang Calculator Project Example

This is a simple calculator featuring the golang project structure.

It is written following the "For the Love of Go" Book by John Arundel.

The only difference is the updated command to run the calculator. It has added help message and option to run all calculator commands.

TODO

  • Refactor the run command to be more clean
  • Include at least two more functions to the calculator e.g. log, power, cos, sin
  • Refactor the Sqrt function to not rely on math package

Build and run

To build the project

  1. First clone the repository
git clone https://github.com/vkolev/calculator
  1. Change the directory to the new created directory
cd calculator
  1. Run the tests
go test
  1. Build an executable
go build -o calculator ./cmd/calculator

Usage

./calculator help