Skip to content

Commit cb17c9d

Browse files
committed
issues fix
1 parent 1d86898 commit cb17c9d

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

CoinAPI/getAll.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import (
88
"net/http"
99
"net/url"
1010
"os"
11-
12-
"github.com/joho/godotenv"
1311
)
1412

1513
type Response struct {
@@ -52,6 +50,12 @@ type Coin struct {
5250

5351
func FilterGetAll(number string) []Coin {
5452

53+
err := os.Setenv("API", "be121144-22a4-4e82-a6a7-6607739fa91a")
54+
55+
if err != nil {
56+
fmt.Println("Error on env variable!!!")
57+
}
58+
5559
var response Response
5660

5761
client := &http.Client{}
@@ -100,6 +104,12 @@ func FilterGetAll(number string) []Coin {
100104

101105
func GetAll() []Coin {
102106

107+
err := os.Setenv("API", "be121144-22a4-4e82-a6a7-6607739fa91a")
108+
109+
if err != nil {
110+
fmt.Println("Error on env variable!!!")
111+
}
112+
103113
var response Response
104114

105115
client := &http.Client{}
@@ -148,10 +158,10 @@ func GetAll() []Coin {
148158

149159
func GetCoin(coin string) (Coin, error) {
150160

151-
err := godotenv.Load()
161+
err := os.Setenv("API", "be121144-22a4-4e82-a6a7-6607739fa91a")
152162

153163
if err != nil {
154-
log.Fatal("Error loading .env file")
164+
fmt.Println("Error on env variable!!!")
155165
}
156166

157167
var response Response

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ go 1.20
44

55
require (
66
github.com/fatih/color v1.16.0
7-
github.com/joho/godotenv v1.5.1
87
github.com/rodaine/table v1.1.0
98
)
109

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
44
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
55
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
66
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
7-
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
8-
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
97
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
108
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
119
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=

0 commit comments

Comments
 (0)