From fa2eef564ca191837adb190282a14034949660f0 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 5 Feb 2015 01:47:10 +0300 Subject: [PATCH] Enhance Package JSON representation with Key, ShortKey and FilesHash. #168 --- deb/package.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deb/package.go b/deb/package.go index cf119de8..b83628d2 100644 --- a/deb/package.go +++ b/deb/package.go @@ -213,7 +213,12 @@ func (p *Package) String() string { // MarshalJSON implements json.Marshaller interface func (p *Package) MarshalJSON() ([]byte, error) { - return json.Marshal(p.Stanza()) + stanza := p.Stanza() + stanza["FilesHash"] = fmt.Sprintf("%08x", p.FilesHash) + stanza["Key"] = string(p.Key("")) + stanza["ShortKey"] = string(p.ShortKey("")) + + return json.Marshal(stanza) } // GetField returns fields from package