From 93ad2758e0cd261996cf329368342bc68e04e710 Mon Sep 17 00:00:00 2001 From: Chris Banks Date: Sun, 6 Aug 2023 18:51:25 +0100 Subject: [PATCH] Enable stylecheck linter and fix errors. --- .golangci.yml | 6 ++++++ lib/router.go | 4 ++-- logger/logger.go | 2 +- main.go | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 0060b70f..916bb7f4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -20,9 +20,15 @@ linters: - promlinter - reassign - revive + - stylecheck - tenv - tparallel - unconvert - usestdlibvars - wastedassign - zerologlint +linters-settings: + stylecheck: + dot-import-whitelist: + - github.com/onsi/ginkgo/v2 + - github.com/onsi/gomega diff --git a/lib/router.go b/lib/router.go index 65b01f55..54939dd2 100644 --- a/lib/router.go +++ b/lib/router.go @@ -48,7 +48,7 @@ type Router struct { type Options struct { MongoURL string - MongoDbName string + MongoDBName string MongoPollInterval time.Duration BackendConnTimeout time.Duration BackendHeaderTimeout time.Duration @@ -193,7 +193,7 @@ func (rt *Router) pollAndReload() { if rt.shouldReload(currentMongoInstance) { logDebug("router: updates found") - rt.reloadRoutes(sess.DB(rt.opts.MongoDbName), currentMongoInstance.Optime) + rt.reloadRoutes(sess.DB(rt.opts.MongoDBName), currentMongoInstance.Optime) } else { logDebug("router: no updates found") } diff --git a/logger/logger.go b/logger/logger.go index 7bfb7790..74900405 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -58,7 +58,7 @@ func openWriter(output interface{}) (w io.Writer, err error) { } } default: - return nil, fmt.Errorf("Invalid output type %T(%v)", output, output) + return nil, fmt.Errorf("invalid output type %T(%v)", output, output) } return } diff --git a/main.go b/main.go index 8e636dd4..eb27205d 100644 --- a/main.go +++ b/main.go @@ -87,7 +87,7 @@ func main() { pubAddr = getenv("ROUTER_PUBADDR", ":8080") apiAddr = getenv("ROUTER_APIADDR", ":8081") mongoURL = getenv("ROUTER_MONGO_URL", "127.0.0.1") - mongoDbName = getenv("ROUTER_MONGO_DB", "router") + mongoDBName = getenv("ROUTER_MONGO_DB", "router") mongoPollInterval = getenvDuration("ROUTER_MONGO_POLL_INTERVAL", "2s") errorLogFile = getenv("ROUTER_ERROR_LOG", "STDERR") tlsSkipVerify = os.Getenv("ROUTER_TLS_SKIP_VERIFY") != "" @@ -109,7 +109,7 @@ func main() { rout, err := router.NewRouter(router.Options{ MongoURL: mongoURL, - MongoDbName: mongoDbName, + MongoDBName: mongoDBName, MongoPollInterval: mongoPollInterval, BackendConnTimeout: beConnTimeout, BackendHeaderTimeout: beHeaderTimeout,