From c5b8dcb6604b3bec44702fa07bf40fa74de36b6a Mon Sep 17 00:00:00 2001 From: xSmurf Date: Tue, 29 Nov 2016 02:42:53 +0000 Subject: [PATCH] Golint.. --- fw-settings/config.go | 4 ++-- sgfw/dns.go | 2 +- sgfw/log.go | 8 +++++--- sgfw/sgfw.go | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fw-settings/config.go b/fw-settings/config.go index a7c8fe2..15be978 100644 --- a/fw-settings/config.go +++ b/fw-settings/config.go @@ -27,7 +27,7 @@ func loadConfig(win *gtk.Window, b *builder, dbus *dbusObject) { } if lvl, ok := conf["log_level"].(int32); ok { - if id, ok := sgfw.LevelToId[lvl]; ok { + if id, ok := sgfw.LevelToID[lvl]; ok { levelCombo.SetActiveID(id) } } @@ -45,7 +45,7 @@ func loadConfig(win *gtk.Window, b *builder, dbus *dbusObject) { } b.ConnectSignals(map[string]interface{}{ "on_level_combo_changed": func() { - if lvl, ok := sgfw.IdToLevel[levelCombo.GetActiveID()]; ok { + if lvl, ok := sgfw.IDToLevel[levelCombo.GetActiveID()]; ok { dbus.setConfig("log_level", lvl) } }, diff --git a/sgfw/dns.go b/sgfw/dns.go index b963ab4..412f1b5 100644 --- a/sgfw/dns.go +++ b/sgfw/dns.go @@ -14,7 +14,7 @@ type dnsCache struct { done chan struct{} } -func NewDnsCache() *dnsCache { +func newDnsCache() *dnsCache { return &dnsCache{ ipMap: make(map[string]string), done: make(chan struct{}), diff --git a/sgfw/log.go b/sgfw/log.go index a0113e9..e634d73 100644 --- a/sgfw/log.go +++ b/sgfw/log.go @@ -8,7 +8,8 @@ import ( "github.com/op/go-logging" ) -var LevelToId = map[int32]string{ +// Log level conversion map +var LevelToID = map[int32]string{ int32(logging.ERROR): "error", int32(logging.WARNING): "warning", int32(logging.NOTICE): "notice", @@ -16,9 +17,10 @@ var LevelToId = map[int32]string{ int32(logging.DEBUG): "debug", } -var IdToLevel = func() map[string]int32 { +// Log level string conversion +var IDToLevel = func() map[string]int32 { m := make(map[string]int32) - for k, v := range LevelToId { + for k, v := range LevelToID { m[v] = k } return m diff --git a/sgfw/sgfw.go b/sgfw/sgfw.go index f548c90..a551465 100644 --- a/sgfw/sgfw.go +++ b/sgfw/sgfw.go @@ -130,7 +130,7 @@ func Main() { fw := &Firewall{ dbus: ds, - dns: NewDnsCache(), + dns: newDnsCache(), enabled: true, logBackend: logBackend, policyMap: make(map[string]*Policy),