You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
302 B
19 lines
302 B
2 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"fmt"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
func loadJson(file string) (WeatherAPI, error) {
|
||
|
var config WeatherAPI
|
||
|
configFile, err := os.Open(file)
|
||
|
if err != nil {
|
||
|
fmt.Println(err.Error())
|
||
|
}
|
||
|
jsonParser := json.NewDecoder(configFile)
|
||
|
jsonParser.Decode(&config)
|
||
|
return config, err
|
||
|
}
|