Skip to content
/ go-hesabu Public

go-hesabu is golang engine to solve simple equations

License

Notifications You must be signed in to change notification settings

BLSQ/go-hesabu

Repository files navigation

Maintainability Go Report Card Build Status Test Coverage

go-hesabu

go-hesabu is golang equivalent to hesabu

Usage

Taking equations

{
  "c": "a + 10 * b",
  "b": "10+a",
  "a": "10"
}

logs the solution

go run hesabu.go ./test/small.json

or via the piped version

cat ./test/small.json | go run hesabu.go

you will get

{
  "a": 10,
  "b": 20,
  "c": 210,
}

Development

Development setup

require a go 1.11

./script/test && go tool cover -func=coverage.out && go tool cover  -html=coverage.out -o coverage.html
go run hesabu.go ./test/small.json

For more info see workspace structure in https://golang.org/doc/code.html

build the cli

if you don't have golang setup

you can use docker

script/docker-build

Which will generate both a Mac version and a Linux version in the bin folder.

if you have golang

script/build

Which will generate both a Mac version and a Linux version in the bin folder.

Profiling

You can run the binary with two additional flags, to enable cpu and memory profiling.

bin/hesabucli -cpuprofile cpu.prof -memprofile mem.prof test/large_set_of_equations.json

Now you should have both a cpu.prof and a mem.prof in your directory.

If you now run:

  go tool pprof cpu.prof

You'll be dropped into an interactive profile viewer.

Even more interesting is that you can open an interactive version in you browser with the following:

  pprof -http=localhost:1234 bin/hesabucli cpu.prof

releasing

have goreleaser https://goreleaser.com/install/

on ubuntu : snap install goreleaser --classic

for github token, use scope repo and see : https://github.com/settings/tokens/new

export GITHUB_TOKEN=...
rm -rf ./dist/
git tag -a v0.0.3 -m "First release with goreleaser"
git push origin v0.0.3
goreleaser release

check the release page https://github.com/BLSQ/go-hesabu/releases/

Dependencies

relies on

License

The code is available as open source under the terms of the MIT License.

About

go-hesabu is golang engine to solve simple equations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •