From e1f3b4b4b728bc59ae8aaf5658ae2acf299ac47d Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 13 Dec 2017 12:52:36 -0500 Subject: [PATCH] proper reprs Signed-off-by: Kenneth Reitz --- connections.go | 2 ++ herald.go | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/connections.go b/connections.go index 14dab6d..0860222 100644 --- a/connections.go +++ b/connections.go @@ -88,6 +88,8 @@ func (r Redis) GetTargetVersions(bp string, target string) []Version { json_value, _ := redis.Bytes(r.Connection.Do("GET", key)) unpack := NewVersion() json.Unmarshal(json_value, &unpack) + unpack.Name = key + unpack.Target = NewTarget(NewBuildpack(bp), target) // Append the results. results = append(results, unpack) diff --git a/herald.go b/herald.go index 21fb360..f2d3101 100644 --- a/herald.go +++ b/herald.go @@ -19,6 +19,7 @@ var BUILDPACKS = []string { "python", "php", "nodejs", "ruby", "jvm-common" } type Version struct { + Name string Target Target Published string `json:"id"` IsValid bool `json:"is_valid"` @@ -36,8 +37,17 @@ func NewVersion() Version { } } -func (vd Version) JSON() []byte { - b, _ := json.Marshal(vd) +func (v Version) String() string { + return fmt.Sprintf( + "", + v.Name, + v.IsPublished, + v.IsValid, + ) +} + +func (v Version) JSON() []byte { + b, _ := json.Marshal(v) return b }