From ed41b539a4791103045d60ef641a73f4cef2ecc3 Mon Sep 17 00:00:00 2001 From: Matthew McPherrin Date: Fri, 24 May 2024 16:38:21 -0400 Subject: [PATCH] More linter fixes --- challtestsrv/challenge-servers.go | 9 +++------ challtestsrv/dnsone.go | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/challtestsrv/challenge-servers.go b/challtestsrv/challenge-servers.go index 85bb38fa..78ad533b 100644 --- a/challtestsrv/challenge-servers.go +++ b/challtestsrv/challenge-servers.go @@ -3,7 +3,7 @@ package challtestsrv import ( - "fmt" + "errors" "log" "net/http" "os" @@ -118,7 +118,7 @@ func (c *Config) validate() error { len(c.HTTPSOneAddrs) < 1 && len(c.DNSOneAddrs) < 1 && len(c.TLSALPNOneAddrs) < 1 { - return fmt.Errorf( + return errors.New( "config must specify at least one HTTPOneAddrs entry, one HTTPSOneAddr " + "entry, one DOHAddrs, one DNSOneAddrs entry, or one TLSALPNOneAddrs entry") } @@ -177,10 +177,7 @@ func New(config Config) (*ChallSrv, error) { for _, address := range config.DOHAddrs { challSrv.log.Printf("Creating DoH server on %s\n", address) - s, err := dohServer(address, config.DOHCert, config.DOHCertKey, http.HandlerFunc(challSrv.dohHandler)) - if err != nil { - return nil, err - } + s := dohServer(address, config.DOHCert, config.DOHCertKey, http.HandlerFunc(challSrv.dohHandler)) challSrv.servers = append(challSrv.servers, s) } diff --git a/challtestsrv/dnsone.go b/challtestsrv/dnsone.go index 5dd61b33..a336cbac 100644 --- a/challtestsrv/dnsone.go +++ b/challtestsrv/dnsone.go @@ -72,7 +72,7 @@ func (s *doh) ListenAndServe() error { } // dohServer creates a DoH server. -func dohServer(address string, tlsCert, tlsCertKey string, handler http.Handler) (*doh, error) { +func dohServer(address string, tlsCert, tlsCertKey string, handler http.Handler) *doh { return &doh{ &http.Server{ Handler: handler, @@ -82,5 +82,5 @@ func dohServer(address string, tlsCert, tlsCertKey string, handler http.Handler) }, tlsCert, tlsCertKey, - }, nil + } }