Skip to content

Commit

Permalink
Updated glide deps
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnaprasadmg committed Mar 6, 2018
1 parent 77cf103 commit 12864e5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
.glide/
vendor/
iban/
4 changes: 2 additions & 2 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ import:
version: ~1.0.0
- package: github.com/spf13/viper
version: ~1.0.0
- package: github.com/spf13/cast
version: ~1.2.0
13 changes: 4 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,16 @@ import (
"github.com/sunspikes/csvToCamt/utils"
)

type Investor struct {
name string
iban string
amount float64
}

func main() {
var configFile string

func init() {
flag.Usage = func() {
fmt.Printf("Usage of %s:\n", os.Args[0])
fmt.Printf("%s -c config.yaml file1.csv file2.csv...\n", os.Args[0])
flag.PrintDefaults()
}
}

func main() {
var configFile string
flag.StringVar(&configFile, "c", "", "Config file to use, see config.yaml for example")
flag.Parse()

Expand Down
7 changes: 3 additions & 4 deletions utils/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package utils
import (
"fmt"

"strconv"
"github.com/spf13/cast"
)

type Transaction struct {
Expand All @@ -16,8 +16,7 @@ type Transaction struct {
}

func (t *Transaction) AddToAmount(amount float64) {
currentAmount, _ := strconv.ParseFloat(t.amount, 64)
t.amount = fmt.Sprintf("%.2f", currentAmount+amount)
t.amount = fmt.Sprintf("%.2f", cast.ToFloat64(t.amount)+amount)
}

func BuildTransactions(investors []Investor) (map[string]*Transaction, float64) {
Expand All @@ -36,7 +35,7 @@ func BuildTransactions(investors []Investor) (map[string]*Transaction, float64)
investor.name,
investor.iban,
"0.0",
fmt.Sprintf("%d", i),
cast.ToString(i),
iban.BankData.Bic,
iban.BankData.Name,
}
Expand Down

0 comments on commit 12864e5

Please sign in to comment.