diff options
author | Ben Morrison <ben@gbmor.dev> | 2020-05-09 17:21:11 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2020-05-09 17:21:11 -0400 |
commit | 825c7e2cd4cc77024c20e31224e3d311196d8e80 (patch) | |
tree | 68c407a4ff495d83d10a10d7c4739cebfdd7e016 | |
parent | 3565a2f54ac9892330a938c0c873e607783208d9 (diff) | |
download | api-825c7e2cd4cc77024c20e31224e3d311196d8e80.tar.gz |
fixed json formatting: removed leading space, added trailing newline
-rw-r--r-- | osversion.go | 6 | ||||
-rw-r--r-- | uptime.go | 6 | ||||
-rw-r--r-- | usercount.go | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/osversion.go b/osversion.go index 3ad501a..297e9cd 100644 --- a/osversion.go +++ b/osversion.go @@ -17,11 +17,11 @@ func osVersionQuery(format string) ([]byte, error) { split := strings.Split(string(out), " ") if format == "json" { - return []byte(fmt.Sprintf(` -{ + return []byte(fmt.Sprintf(`{ "os": "%s", "version": "%s" -}`, split[0], split[2])), nil +} +`, split[0], split[2])), nil } return []byte(fmt.Sprintf("%s %s", split[0], split[2])), nil diff --git a/uptime.go b/uptime.go index 2dd45f3..07bcc47 100644 --- a/uptime.go +++ b/uptime.go @@ -28,12 +28,12 @@ func uptimeQuery(format string) ([]byte, error) { loadcomb := strings.Split(string(split[3]), " ") loads := fmt.Sprintf("%s,%s,%s", loadcomb[1], split[3], split[4]) - json := fmt.Sprintf(` -{ + json := fmt.Sprintf(`{ "time": "%s", "up": "%s", "load": "%s" -}`, time, up, loads) +} +`, time, up, loads) return []byte(json), nil } diff --git a/usercount.go b/usercount.go index 0afc462..ff35463 100644 --- a/usercount.go +++ b/usercount.go @@ -20,10 +20,10 @@ func userCountQuery(format string) ([]byte, error) { return []byte(fmt.Sprintf("%v users", len(split))), nil } - out := fmt.Sprintf(` -{ + out := fmt.Sprintf(`{ "userCount": "%v" -}`, len(split)) +} +`, len(split)) return []byte(out), nil } |