Repository navigation
build: support --format (pb and json) - #52
AkihiroSuda wants to merge 1 commit into
Conversation
|
example output (after {
"resource": [
{
"path": [
"/a"
],
"uid": "1001",
"gid": "1001",
"mode": 2147484157
},
{
"path": [
"/a/b"
],
"uid": "1001",
"gid": "1001",
"mode": 436,
"size": "476",
"digest": [
"sha256:ef290472c423c80ce142a1617ac556e5935f02b30db1c28c8ed38c15b62e9e3e"
]
}
]
} |
|
I think this is a reasonable addition. I am wondering though if we want to keep the existing package interface the same for |
|
@dmcgowan thank you, updated PR |
|
@stevvooe PTAL if you have a time? 😃 |
|
@AkihiroSuda Could we not emit fields when they are empty? |
|
It should have been already omitted, but due to a bug in protobuf, it is not actually omitted 😭 I confirmed the following patch for protobuf successfully omits empty diff --git a/jsonpb/jsonpb.go b/jsonpb/jsonpb.go
index 82c6162..9999705 100644
--- a/jsonpb/jsonpb.go
+++ b/jsonpb/jsonpb.go
@@ -188,6 +188,10 @@ func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeU
if !m.EmitDefaults {
switch value.Kind() {
+ case reflect.Map:
+ if len(value.MapKeys()) == 0 {
+ continue
+ }
case reflect.Bool:
if !value.Bool() {
continueI'll open PR to protobuf later. |
|
protobuf maintainers seems unresponsive to golang/protobuf#327, do we need to wait for golang/protobuf#327 ? |
|
protobuf maintainers are still unresponsive to my PR about Can you please consider merging this PR as-is? |
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
|
rebased, and |
|
@AkihiroSuda Has that change made it to gogo/protobuf? |
|
Seems not yet |
|
opened PR gogo/protobuf#296 |
|
Its merged. Sorry for the delay. |
|
thank you |
|
@awalterschulze As always, thanks for the great support! |
|
@AkihiroSuda Could you update the example output? |
|
@AkihiroSuda Also, should probably rename the |
let me do that in another PR |
|
update the example output. |
|
@AkihiroSuda I think so, but we let's not build anything permanent on it yet. |
This PR implements
continuity build --format.Fix #46
e.g.
alias:
The JSON format is implemented using
jsonpb.Marshaller{EnumAsInts: false, EmitDefaults: false, OrigName: false}. https://godoc.org/github.com/golang/protobuf/jsonpb#MarshalerJSON format would be useful when a continuity manifest is included in an OCI image.
Signed-off-by: Akihiro Suda suda.akihiro@lab.ntt.co.jp