Giter Site home page Giter Site logo

accounting's People

Contributors

agungcandra avatar daniele-dynabase avatar djackreuter avatar leekchan avatar optiojohn avatar tamalsaha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

accounting's Issues

Blocking Urgent Problem

Hi.

It seems the package github.com/cockroachdb/apd was update yesterday and I am getting this.

github.com/leekchan/accounting
../../leekchan/accounting/formatnumber.go:79: d.ToStandard undefined (type *apd.Decimal has no field or method ToStandard)
../../leekchan/accounting/formatnumber.go:139: d.ToStandard undefined (type *apd.Decimal has no field or method ToStandard)

@leekchan Can you fix the problem?

Cannot compile for 32-bit

Error:
leekchan/accounting/formatnumber.go:90: constant -9223372036854775808 overflows int

Won't compile for 32-bit architectures (main target is ARMv7)

Proposal: Please start using Semantic Versioning

I found that this project already supports Go modules. But sadly, the tags doesn't follow Semantic Versioning, which means that all tags of this project will be ignored by Go modules and replaced by pseudo-versions, go get acts weirdly when tags are not in that form. It would be great to have the tagged release be named in the format vX.X.X format so that go mod can read it.

$ go get github.com/leekchan/[email protected]
go get github.com/leekchan/[email protected]: no matching versions for query "v0.3"
$ go get github.com/leekchan/accounting
go: downloading github.com/leekchan/accounting v0.0.0-20191218023648-17a4ce5f94d4
go: github.com/leekchan/accounting upgrade => v0.0.0-20191218023648-17a4ce5f94d4
github.com/leekchan/accounting v0.0.0-20191218023648-17a4ce5f94d4

Else the mod file shows something like github.com/leekchan/accounting v0.0.0-20191218023648-17a4ce5f94d4 which is not very readable and difficult to upgrade. It’s hard to verify which version is in use. This is not conducive to version control

So, I propose this project to follow Semantic Versioning in future versions. For example, v1.0.1, v2.0.0, v3.1.0-alpha, v3.1.0-beta.2etc.

Support for generics

Are there any plans to support generics?

Rewriting with generics could largely reduce the risk of exposing runtime panics and converting them into compile-time errors.
For example:

func (accounting *Accounting) FormatMoney(value interface{}) string

The FormatMoney function takes in any type and does type a check only at runtime.

Happy to help with the refactor if it sounds like a good idea.

Some features in Locale aren't available for formatting

Hi, thanks for a great library!

I'm working on a system that's dealing with both fiat currencies and a couple of cryptocurrencies and I thought I could easily build a Locale object to describe common crypto formats (all decimal places, symbol after the number, etc)

I have this:

var cryptos = map[string]accounting.Locale{
	"USDC": {
		Name:           "USD Coin",
		FractionLength: 11,
		ThouSep:        ",",
		DecSep:         ".",
		SpaceSep:       " ",
		UTFSymbol:      "",
		HTMLSymbol:     "",
		ComSymbol:      "USDC",
		Pre:            false,
	},
}

But then I realised, the actual formatting API doesn't accept some of these parameters, most importantly Pre which I wanted to use to place the symbol after the value, which seems to be the consensus around crypto currency value formatting:

123.435 USDC

For example.

It seems this could be implemented in the formatMoneyString function if Accounting had a Pre field.

Though, it also begs the question, why not just embed Locale into Accounting?

Anyway, would be happy to submit a PR for formatMoneyString!

constant -9223372036854775808 overflows int

I'm getting this error when trying to build (go 1.6 - GOOS=linux GOARCH=386 go build):

github.com/leekchan/accounting
../../../.gvm/pkgsets/go1.6/global/src/github.com/leekchan/accounting/formatnumber.go:90: constant -9223372036854775808 overflows int

Any advice?

Thanks.

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.