Showing
2 changed files
with
9 additions
and
11 deletions
... | ... | @@ -26,6 +26,8 @@ package version |
26 | 26 | |
27 | 27 | import ( |
28 | 28 | "encoding/json" |
29 | + | |
30 | + "gitlab.weird-web-workers.org/golang/logger" | |
29 | 31 | ) |
30 | 32 | |
31 | 33 | type Version struct { |
... | ... | @@ -35,24 +37,24 @@ type Version struct { |
35 | 37 | BuildTime string `json:"BuildTime"` |
36 | 38 | } |
37 | 39 | |
38 | -type versionSlice map[string]Version | |
40 | +type versionMap map[string]Version | |
39 | 41 | |
40 | 42 | var ( |
41 | - versions = make(versionSlice) | |
43 | + versions = make(versionMap) | |
42 | 44 | ) |
43 | 45 | |
44 | 46 | func (v Version) Register() { |
45 | 47 | versions[v.Package] = v |
46 | 48 | } |
47 | 49 | |
48 | -func (vs versionSlice)Json() string { | |
49 | - vSlice := make([]Version, len(vs)) | |
50 | - for v := range vs { | |
50 | +func (vMap versionMap) Json() []byte { | |
51 | + vSlice := make([]Version, len(vMap)) | |
52 | + for _, v := range vMap { | |
51 | 53 | vSlice = append(vSlice, v) |
52 | 54 | } |
53 | 55 | vJson, err := json.Marshal(vSlice) |
54 | 56 | logger.Default.FailOnError(err, "Unable to marshal versions") |
55 | 57 | return vJson |
56 | -) | |
58 | +} | |
57 | 59 | |
58 | 60 | // vim: ts=4 sts=4 sw=4 noet tw=72: | ... | ... |
... | ... | @@ -24,11 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. |
24 | 24 | */ |
25 | 25 | package version |
26 | 26 | |
27 | -import ( | |
28 | - "gitlab.weird-web-workers.org/golang/version" | |
29 | -) | |
30 | - | |
31 | -const ( | |
27 | +var ( | |
32 | 28 | VERSION = Version{ |
33 | 29 | Package: "m4_package", |
34 | 30 | Version: "m4_version", | ... | ... |
Please
register
or
login
to post a comment