Skip to content

Commit

Permalink
Change v1
Browse files Browse the repository at this point in the history
  • Loading branch information
kolomiichenko committed Mar 4, 2017
1 parent 62a3916 commit 762c14d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Get currency rates from Central Bank of Russia
package main

import (
cbr "cbr-currency-go"
"gopkg.in/kolomiichenko/cbr-currency-go.v1"
"log"
)

func main() {
cbr.updateCurrency() // force update
cbr.updateCurrency() // force update
log.Println(cbr.CurrencyRates["USD"])
}
```
Expand Down
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type currencyRate struct {
Value float64
}

// CurrencyRates Global map with rates
var CurrencyRates map[string]currencyRate

func init() {
Expand All @@ -48,11 +49,11 @@ func doEvery(d time.Duration, f func()) {
}
}

// UpdateCurrencyRates To sync rates from CBR server
func UpdateCurrencyRates() {
log.Println("Updating CBR rates...")
resp, err := http.Get("http://www.cbr.ru/scripts/XML_daily.asp")
if err != nil {
log.Fatalf("Error of get currency: %v", err.Error())
log.Printf("Error of get currency: %v", err.Error())
}

var data xmlResult
Expand Down

0 comments on commit 762c14d

Please sign in to comment.