Rhymond/go-money

Suggestion: Provide constant values for currency codes

Closed this issue · 3 comments

Like the net/http package status codes and the use of time.Second etc. in the time package, I suggest providing currency codes as public constants.

I understand that they would represent a string of the same name but would make it easier to ensure that the currency code you're using is correct through autocompletion in editors.

I wanted to gather some feedback on this before having a go at implementing it. It shouldn't change the API as the constants will just act as helpers that can be used instead of passing a string literal as an argument, for example:

pound := money.New(100, money.GBP)

+1 from me, i was looking for those constants the first couple of times using this package

This would be a nice addition IMO. +1

Since this issue has been fixed can we close this now @jamesallured