mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 12:27:18 +00:00
417bb45398
* v2 refactor * fix up imports * builds * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge branch 'master' into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * imports keymanager v1 * Update validator/keymanager/v1/remote.go * Update validator/client/polling/propose.go * Update validator/keymanager/v1/wallet.go * fmt * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * Merge refs/heads/master into accounts-revamp-p1 * fix conf * fix build * gaz
33 lines
659 B
Go
33 lines
659 B
Go
package v1
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io/ioutil"
|
|
"strings"
|
|
)
|
|
|
|
// decodeOpts decodes a value in to an options container.
|
|
// The input can be either JSON data or a path to a file containing JSON.
|
|
// This function returns an error if there is a problem decoding the input.
|
|
func decodeOpts(input string, res interface{}) error {
|
|
if input == "" {
|
|
// Empty input is okay.
|
|
return nil
|
|
}
|
|
|
|
var data []byte
|
|
if strings.HasPrefix(input, "{") {
|
|
// Looks like straight JSON.
|
|
data = []byte(input)
|
|
} else {
|
|
// Assume it's a path.
|
|
file, err := ioutil.ReadFile(input)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
data = file
|
|
}
|
|
|
|
return json.Unmarshal(data, res)
|
|
}
|