Skip to content

Commit 2dc7d46

Browse files
committed
mod+cli: default to hex encoding for byte slices
1 parent b694a76 commit 2dc7d46

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

cmd/loop/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ package main
22

33
import (
44
"bytes"
5-
"encoding/json"
65
"errors"
76
"fmt"
87
"os"
98
"strconv"
109
"time"
1110

12-
"github.com/golang/protobuf/jsonpb"
13-
"github.com/golang/protobuf/proto"
1411
"github.com/lightninglabs/loop"
1512
"github.com/lightninglabs/loop/looprpc"
1613
"github.com/lightninglabs/loop/swap"
14+
"github.com/lightninglabs/protobuf-hex-display/json"
15+
"github.com/lightninglabs/protobuf-hex-display/jsonpb"
16+
"github.com/lightninglabs/protobuf-hex-display/proto"
1717

1818
"github.com/btcsuite/btcutil"
1919

@@ -53,6 +53,7 @@ func printJSON(resp interface{}) {
5353

5454
func printRespJSON(resp proto.Message) {
5555
jsonMarshaler := &jsonpb.Marshaler{
56+
OrigName: true,
5657
EmitDefaults: true,
5758
Indent: " ",
5859
}

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/google/go-cmp v0.3.1 // indirect
1111
github.com/grpc-ecosystem/grpc-gateway v1.10.0
1212
github.com/jessevdk/go-flags v1.4.0
13+
github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d
1314
github.com/lightningnetwork/lnd v0.9.0-beta-rc3.0.20200121213302-a2977c4438b5
1415
github.com/lightningnetwork/lnd/queue v1.0.2
1516
github.com/urfave/cli v1.20.0

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf h1:HZKvJUHlcXI
136136
github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf/go.mod h1:vxmQPeIQxPf6Jf9rM8R+B4rKBqLA2AjttNxkFBL2Plk=
137137
github.com/lightninglabs/neutrino v0.11.0 h1:lPpYFCtsfJX2W5zI4pWycPmbbBdr7zU+BafYdLoD6k0=
138138
github.com/lightninglabs/neutrino v0.11.0/go.mod h1:CuhF0iuzg9Sp2HO6ZgXgayviFTn1QHdSTJlMncK80wg=
139+
github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d h1:QWD/5MPnaZfUVP7P8wLa4M8Td2DI7XXHXt2vhVtUgGI=
139140
github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d/go.mod h1:KDb67YMzoh4eudnzClmvs2FbiLG9vxISmLApUkCa4uI=
140141
github.com/lightningnetwork/lightning-onion v1.0.1 h1:qChGgS5+aPxFeR6JiUsGvanei1bn6WJpYbvosw/1604=
141142
github.com/lightningnetwork/lightning-onion v1.0.1/go.mod h1:rigfi6Af/KqsF7Za0hOgcyq2PNH4AN70AaMRxcJkff4=

0 commit comments

Comments
 (0)