I'm trying out the samples at https://github.com/leekchan/accounting
package main
import (
"fmt"
"math/big"
"github.com/shopspring/decimal"
"github.com/leekchan/accounting"
)
func main() {
ac := accounting.Accounting{Symbol: "$", Precision: 2}
fmt.Println(ac.FormatMoney(123456789.213123))
}
and using them exactly as showing on Github I'm getting the following error:
Failed parsing input: package "github.com/shopspring/decimal" is imported from multiple locations: "/users/dev/go/src/github.com/shopspring/decimal" and "/users/dev/go/src/github.com/leekchan/accounting/vendor/github.com/shopspring/decimal"
I can't leave out:
github.com/shopspring/decimal
or I'll get another error. I tried:
"dec" github.com/shopspring/decimal
but that doesn't change anything. Shouldn't it?
Weird thing is I can't find any details about this anywhere. Am I really the only person getting this, or am I missing something completely obvious?
This is because they have a checked in vendor directory that contains github.com/shopspring/decimal which it appears you already have on your path. You are best having a single vendor directory inside your project that contains both github.com/shopspring/decimal and github.com/leekchan/accounting so that you directory structure will look like:
- main.go
| - vendor
| - github.com/leekchan/accounting
| - github.com/shopspring/decimal