From d4e1513d3d6344e483b85c378fac5573099c37dc Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Fri, 24 Dec 2021 02:10:35 +0000 Subject: [PATCH 1/4] Cirrus: Mark errcheck linter as mandatory --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 052334e..047c25f 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -60,7 +60,7 @@ task: - name: "Go Lint $GOOS Mandatory$MODULES_NAME" env: # TODO: Re-enable varnamelen after golangci-lint v1.44 is released. - GOLANGCI_ARGS: "--disable=cyclop,deadcode,errcheck,errorlint,exhaustivestruct,forbidigo,forcetypeassert,funlen,gci,gocognit,gocritic,godot,godox,goerr113,gofumpt,goimports,golint,gosec,gosimple,govet,ineffassign,lll,maligned,nakedret,nestif,nilerr,nlreturn,paralleltest,revive,scopelint,staticcheck,stylecheck,thelper,unconvert,unparam,unused,varnamelen,wastedassign,whitespace,wrapcheck,wsl" + GOLANGCI_ARGS: "--disable=cyclop,deadcode,errorlint,exhaustivestruct,forbidigo,forcetypeassert,funlen,gci,gocognit,gocritic,godot,godox,goerr113,gofumpt,goimports,golint,gosec,gosimple,govet,ineffassign,lll,maligned,nakedret,nestif,nilerr,nlreturn,paralleltest,revive,scopelint,staticcheck,stylecheck,thelper,unconvert,unparam,unused,varnamelen,wastedassign,whitespace,wrapcheck,wsl" - name: "Go Lint $GOOS$MODULES_NAME" env: GOLANGCI_ARGS: "" From 04193f251e49ca901e6cd2976731557e5287f0c0 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Fri, 24 Dec 2021 02:22:53 +0000 Subject: [PATCH 2/4] Explicitly suppress error returned by parseImport This error is already logged by parseImportImpl, so suppresing it is not a bug. Making the suppression explicit fixes a static analysis warning. --- ncdomain/convert.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ncdomain/convert.go b/ncdomain/convert.go index fc17ad8..aaaf703 100644 --- a/ncdomain/convert.go +++ b/ncdomain/convert.go @@ -399,7 +399,7 @@ func parse(rv interface{}, v *Value, resolve ResolveFunc, errFunc ErrorFunc, dep return } - parseImport(rvm, v, resolve, errFunc, depth, mergeDepth, relname, mergedNames) + _ = parseImport(rvm, v, resolve, errFunc, depth, mergeDepth, relname, mergedNames) if ip, ok := rvm["ip"]; ok { parseIP(rvm, v, errFunc, ip, false) } From 30b48de35668cac0c6bd942d860172184bc2169c Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Fri, 24 Dec 2021 02:30:07 +0000 Subject: [PATCH 3/4] Explicitly suppress error returned by DomainValueHookTLS This error is already logged, so suppresing it is not a bug. Making the suppression explicit fixes a static analysis warning. --- backend/backend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/backend.go b/backend/backend.go index c7ad267..38c5f5e 100644 --- a/backend/backend.go +++ b/backend/backend.go @@ -455,7 +455,7 @@ func (tx *btx) addAnswersUnderNCValueActual(ncv *ncdomain.Value, sn string) (rrs // TODO: add callback variable "OnValueReferencedFunc" to backend options so that we don't pollute this function with every hook that we want // might need to add the other attributes of tx, and sn, to the callback variable for flexibility's sake // This doesn't normally return errors, but any errors during execution will be logged. - tlshook.DomainValueHookTLS(tx.qname, ncv) + _ = tlshook.DomainValueHookTLS(tx.qname, ncv) return } From 7f7467ae1f9589140bfa98d60bc2ed15ad38c741 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Fri, 24 Dec 2021 02:40:16 +0000 Subject: [PATCH 4/4] Log HTTP server errors --- server/web.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/web.go b/server/web.go index 614e8aa..8d3f16a 100644 --- a/server/web.go +++ b/server/web.go @@ -214,7 +214,9 @@ func webStart(listenAddr string, server *Server) error { Handler: ws, } - go s.ListenAndServe() - // TODO: error handling + go func() { + err := s.ListenAndServe() + log.Errore(err, "HTTP server") + }() return nil }