From 833b18a9968d5369a0b4959347cbcede8fe58d08 Mon Sep 17 00:00:00 2001 From: Helena Rasche Date: Wed, 6 Mar 2024 21:39:47 +0100 Subject: [PATCH] tidy --- main.go | 2 +- read.go | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index 46faeb8..297c495 100644 --- a/main.go +++ b/main.go @@ -54,7 +54,7 @@ func issuePage(w http.ResponseWriter, r *http.Request) { entries := aggregateIdenticalMessages(string(msg_bytes), 24) type Zzy struct { - Entry LogEntry + Entry LogEntry Message string } diff --git a/read.go b/read.go index 1684239..1248a71 100644 --- a/read.go +++ b/read.go @@ -4,8 +4,8 @@ import ( "encoding/base64" "encoding/json" "fmt" - "strings" "sort" + "strings" "time" // "github.com/coreos/go-systemd/v22/journal" "github.com/coreos/go-systemd/v22/sdjournal" @@ -108,7 +108,7 @@ func (e LogEntry) GetBrowserMeta(attr string) map[string]float64 { total := len(e.Entries) results := make(map[string]float64) for k, v := range browsers { - if k == "" || k == " " { + if k == "" || k == " " { continue } results[k] = float64(v) / float64(total) @@ -118,7 +118,6 @@ func (e LogEntry) GetBrowserMeta(attr string) map[string]float64 { return results } - func (e LogEntry) GetMeta(attr string) map[string]float64 { browsers := make(map[string]int) for _, entry := range e.Entries { @@ -145,8 +144,6 @@ func (e LogEntry) GetMeta(attr string) map[string]float64 { return results } - - func (e LogEntry) GetCount() int { return len(e.Entries) } @@ -165,10 +162,10 @@ func (e LogEntry) GetHistogram12h() []float64 { if hour > 11 { continue } - - hist[11 - hour] = hist[11 - hour] + 1 - if hist[11 - hour] > m { - m = hist[11 - hour] + + hist[11-hour] = hist[11-hour] + 1 + if hist[11-hour] > m { + m = hist[11-hour] } }