Giter Site home page Giter Site logo

goalconvert's Introduction

Go Alcohol Converter (module and CLI)

Using this you can convert alcohol (drinkable) millilitres, percentage and units.

The units are the UK definition which you can checkout here: https://www.nhs.uk/live-well/alcohol-advice/calculating-alcohol-units/

From the above link: "One unit equals 10ml or 8g of pure alcohol, which is around the amount of alcohol the average adult can process in an hour."

It can be used as a module for your own application or as a CLI by itself.

You can checkout dosages for units here: https://psychonautwiki.org/wiki/Alcohol

This project is not for the endorsement of alcohol consumption. The aim is to help people get a perspective of what different amounts mean.

Stay safe!

Using Terminal Program Example

Calculate units:

goalconvert -ml 200 -perc 40

Calculate target units:

goalconvert -ml 200 -perc 40 -taruni 2

Others:

goalconvert -help

Using Module Example

Calculate units:

package main

import "github.com/powerjungle/goalconvert"

func main() {
  av := alconvert.NewAV()
  av.UserSet.Milliliters = 200
  av.UserSet.Percent = 40
  av.CalcGotUnits()
  av.PrintForHumans()
}

Module Documentation

https://pkg.go.dev/github.com/powerjungle/goalconvert

Dependencies

If you have an already built binary from the "Releases" page, you don't need these.

For Go compilation/installation you'll need this.

Installation

If you don't want or can't use the already built binaries in the "Releases" page.

CLI: go install github.com/powerjungle/goalconvert/cmd@latest

If you want to use as a module for your code.

Module: go get github.com/powerjungle/goalconvert

Compilation

go build .

Run the command where the README.md file is!

Testing

If you want to run the tests: go test

Benchmarks

To run the benchmarks: go test -bench=.

Releases

The approprate packages need to be installed. Checkout Dependencies!

To install Goreleaser: https://goreleaser.com/install/

To do a release: https://goreleaser.com/cmd/goreleaser/

The .goreleaser.yaml file is already done and is in the repo.

If you don't want to release for all OSs and architecture or want for more, edit the .goreleaser.yaml file! Info on how to edit here:

https://goreleaser.com/customization/build/

All Go OS and architecture combos here:

https://go.dev/doc/install/source#environment

This needs to be tested every time it's changed, as not all builds work without some preparation.

goalconvert's People

Contributors

powerjungle avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.