From ded845ed46a22fc36feda39a496757d1df5a72b8 Mon Sep 17 00:00:00 2001 From: s3lph <1375407-s3lph@users.noreply.gitlab.com> Date: Fri, 8 Apr 2022 21:28:31 +0200 Subject: [PATCH] happier golangci-lint --- main.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index e034b85..388d918 100644 --- a/main.go +++ b/main.go @@ -193,15 +193,13 @@ func (c *MetricsCollector) signatureOk(zone string) (bool, int, error) { if err != nil { return false, rsoa.MsgHdr.Rcode, err } - level.Debug(c.Log).Log(fmt.Sprintf("SOA header: %+v\n", rsoa.MsgHdr)) + _ = level.Debug(c.Log).Log(fmt.Sprintf("SOA header: %+v\n", rsoa.MsgHdr)) return rsoa.MsgHdr.AuthenticatedData && rsoa.MsgHdr.Rcode == dns.RcodeSuccess, rsoa.MsgHdr.Rcode, nil } func (c *MetricsCollector) cdsDsMatches(zone string) (int, int, int, int, bool, error) { dsCount := 0 - dsRcode := -1 cdsCount := 0 - cdsRcode := -1 match := false var dsdata []DsData var cdsdata []DsData @@ -209,11 +207,11 @@ func (c *MetricsCollector) cdsDsMatches(zone string) (int, int, int, int, bool, qcds := new(dns.Msg) qcds.SetQuestion(dns.Fqdn(zone), dns.TypeCDS) rcds, _, err1 := c.DNS.Exchange(qcds, c.Resolver) - cdsRcode = rcds.MsgHdr.Rcode + cdsRcode := rcds.MsgHdr.Rcode if err1 == nil { cdsCount = len(rcds.Answer) cdsdata = make([]DsData, len(rcds.Answer)) - level.Debug(c.Log).Log(fmt.Sprintf("CDS data: %+v\n", rcds.Answer)) + _ = level.Debug(c.Log).Log(fmt.Sprintf("CDS data: %+v\n", rcds.Answer)) for i, a := range rcds.Answer { ds := a.(*dns.CDS).DS cdsdata[i] = DsData{ @@ -229,11 +227,11 @@ func (c *MetricsCollector) cdsDsMatches(zone string) (int, int, int, int, bool, qds := new(dns.Msg) qds.SetQuestion(dns.Fqdn(zone), dns.TypeDS) rds, _, err2 := c.DNS.Exchange(qds, c.Resolver) - dsRcode = rds.MsgHdr.Rcode + dsRcode := rds.MsgHdr.Rcode if err2 == nil { dsCount = len(rds.Answer) dsdata = make([]DsData, len(rds.Answer)) - level.Debug(c.Log).Log(fmt.Sprintf("DS data: %+v\n", rds.Answer)) + _ = level.Debug(c.Log).Log(fmt.Sprintf("DS data: %+v\n", rds.Answer)) for i, a := range rds.Answer { ds := a.(*dns.DS) dsdata[i] = DsData{ @@ -295,12 +293,12 @@ func main() { if configFile != nil { content, err := ioutil.ReadFile(*configFile) if err != nil { - level.Error(logger).Log(err.Error()) + _ = level.Error(logger).Log(err.Error()) os.Exit(1) } err = yaml.Unmarshal(content, &config) if err != nil { - level.Error(logger).Log(err.Error()) + _ = level.Error(logger).Log(err.Error()) os.Exit(1) } } @@ -315,5 +313,5 @@ func main() { prom.MustRegister(metricsCollector) http.Handle(*metricsPath, promhttp.Handler()) server := &http.Server{Addr: *listenAddress} - logger.Log(web.ListenAndServe(server, *webConfigFile, logger)) + _ = logger.Log(web.ListenAndServe(server, *webConfigFile, logger)) }