Fix -json flag when running -genconf

This commit is contained in:
Neil Alexander 2019-09-02 13:25:26 +01:00
parent 7352891564
commit 7444c46aa1
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -65,7 +65,7 @@ func (cfg *NodeConfig) NewSigningKeys() {
// MarshalJSON exports the configuration into JSON format. No comments are // MarshalJSON exports the configuration into JSON format. No comments are
// included in the JSON export as comments are not valid in pure JSON. // included in the JSON export as comments are not valid in pure JSON.
func (cfg *NodeConfig) MarshalJSON() ([]byte, error) { func (cfg *NodeConfig) MarshalJSON() ([]byte, error) {
bs, err := json.MarshalIndent(cfg, "", " ") bs, err := json.MarshalIndent(*cfg, "", " ")
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -75,7 +75,7 @@ func (cfg *NodeConfig) MarshalJSON() ([]byte, error) {
// MarshalHJSON exports the configuration into HJSON format, complete with // MarshalHJSON exports the configuration into HJSON format, complete with
// comments describing what each configuration item does. // comments describing what each configuration item does.
func (cfg *NodeConfig) MarshalHJSON() ([]byte, error) { func (cfg *NodeConfig) MarshalHJSON() ([]byte, error) {
bs, err := hjson.Marshal(cfg) bs, err := hjson.Marshal(*cfg)
if err != nil { if err != nil {
return nil, err return nil, err
} }