Commit 54249555a5197d85ce64321a2c0dca1a6bc4d4bd

Authored by Georg Hopp
1 parent dce871b3

latest fixes

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