mirror of
https://github.com/Baipyrus/ProxySwitcher.git
synced 2024-12-27 05:01:45 +00:00
util/config.go auto formatting
This commit is contained in:
parent
20e55efc25
commit
16d0bd7ca4
@ -6,21 +6,21 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ReadConfigs() ([]Config, error) {
|
func ReadConfigs() ([]*Config, error) {
|
||||||
file, readErr := os.Open("configs.json")
|
file, err := os.Open("configs.json")
|
||||||
|
|
||||||
if readErr != nil {
|
if err != nil {
|
||||||
return nil, readErr
|
return nil, err
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
bytes, _ := io.ReadAll(file)
|
bytes, _ := io.ReadAll(file)
|
||||||
|
|
||||||
var config []Config
|
var config []*Config
|
||||||
unmarshalErr := json.Unmarshal(bytes, &config)
|
err = json.Unmarshal(bytes, &config)
|
||||||
|
|
||||||
if unmarshalErr != nil {
|
if err != nil {
|
||||||
return nil, unmarshalErr
|
return nil, err
|
||||||
}
|
}
|
||||||
return config, nil
|
return config, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user