mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-09 15:11:10 +00:00
Makefile: add new recipes and linter features (#244)
* Makefile: add new recipes and linter features * expand linter coverage and fix issues * Update makefile * address PR nitterinos
This commit is contained in:
@@ -43,7 +43,7 @@ func encodePEM(privKey *ecdsa.PrivateKey, pubKey bool) ([]byte, error) {
|
||||
}
|
||||
|
||||
func decodePEM(PEMPrivKey, PEMPubKey []byte) (*ecdsa.PrivateKey, *ecdsa.PublicKey, error) {
|
||||
block, _ := pem.Decode([]byte(PEMPrivKey))
|
||||
block, _ := pem.Decode(PEMPrivKey)
|
||||
if block == nil {
|
||||
return nil, nil, errors.New("priv block data is nil")
|
||||
}
|
||||
@@ -54,7 +54,7 @@ func decodePEM(PEMPrivKey, PEMPubKey []byte) (*ecdsa.PrivateKey, *ecdsa.PublicKe
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
blockPub, _ := pem.Decode([]byte(PEMPubKey))
|
||||
blockPub, _ := pem.Decode(PEMPubKey)
|
||||
if block == nil {
|
||||
return nil, nil, errors.New("pub block data is nil")
|
||||
}
|
||||
@@ -97,7 +97,8 @@ func main() {
|
||||
}
|
||||
|
||||
if genKeys {
|
||||
pKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
||||
var pKey *ecdsa.PrivateKey
|
||||
pKey, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -115,13 +116,15 @@ func main() {
|
||||
}
|
||||
|
||||
} else {
|
||||
pubKeyData, err := common.ReadFile("publickey.pem")
|
||||
var pubKeyData []byte
|
||||
pubKeyData, err = common.ReadFile("publickey.pem")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Println("Successfully read PEM files.")
|
||||
|
||||
priv, _, err := decodePEM(privKeyData, pubKeyData)
|
||||
var priv *ecdsa.PrivateKey
|
||||
priv, _, err = decodePEM(privKeyData, pubKeyData)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user