Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Exchanger Error #1

Open
thaitanloi365 opened this issue Dec 24, 2020 · 1 comment
Open

Google Exchanger Error #1

thaitanloi365 opened this issue Dec 24, 2020 · 1 comment

Comments

@thaitanloi365
Copy link

Describe the bug

	SwapTest := swap.NewSwap()

	SwapTest.
		AddExchanger(ex.NewGoogleApi(nil)).
		AddExchanger(ex.NewYahooApi(nil)).
		Build()

	euroToUsdRate := SwapTest.Latest("EUR/USD")
	fmt.Println(euroToUsdRate.GetRateValue())
	fmt.Println(euroToUsdRate.GetRateDateTime())
	fmt.Println(euroToUsdRate.GetExchangerName())

I tried to run the example from the repo and got this error.

=== RUN   TestCurrencyExchange2
--- FAIL: TestCurrencyExchange2 (0.83s)
panic: runtime error: index out of range [2] with length 0 [recovered]
	panic: runtime error: index out of range [2] with length 0

goroutine 6 [running]:
testing.tRunner.func1.1(0x1321400, 0xc0003d2160)
	/usr/local/Cellar/go/1.15/libexec/src/testing/testing.go:1057 +0x30d
testing.tRunner.func1(0xc000001b00)
	/usr/local/Cellar/go/1.15/libexec/src/testing/testing.go:1060 +0x41a
panic(0x1321400, 0xc0003d2160)
	/usr/local/Cellar/go/1.15/libexec/src/runtime/panic.go:969 +0x175
github.com/me-io/go-swap/pkg/exchanger.(*googleApi).Latest(0xc00014e100, 0x13419ec, 0x3, 0x13419f0, 0x3, 0xc00015c160, 0x1, 0x1, 0x2, 0x1342631)
	/Volumes/Data/go/pkg/mod/github.com/me-io/[email protected]/pkg/exchanger/google.go:97 +0x353
github.com/me-io/go-swap/pkg/swap.(*Swap).Latest(0xc000040748, 0x13419ec, 0x7, 0x1, 0x2)
	/Volumes/Data/go/pkg/mod/github.com/me-io/[email protected]/pkg/swap/swap.go:45 +0x194
github.com/thaitanloi365/swop-backend/tests.TestCurrencyExchange2(0xc000001b00)
	/Volumes/Data/Projects/swop-backend/tests/currency_test.go:21 +0x151
testing.tRunner(0xc000001b00, 0x135b4e8)
	/usr/local/Cellar/go/1.15/libexec/src/testing/testing.go:1108 +0xef
created by testing.(*T).Run
	/usr/local/Cellar/go/1.15/libexec/src/testing/testing.go:1159 +0x386
@ironytr
Copy link

ironytr commented Nov 16, 2023

no fix yet? hmm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants