diff --git a/.travis/script b/.travis/script index 55324d0..3caa390 100644 --- a/.travis/script +++ b/.travis/script @@ -1,6 +1,6 @@ #!/bin/bash -travis_retry go get github.com/tcnksm/ghr github.com/mitchellh/gox gopkg.in/alecthomas/gometalinter.v1 github.com/miekg/exdns/q github.com/namecoin/dns-prop279 +travis_retry go get github.com/tcnksm/ghr github.com/mitchellh/gox gopkg.in/alecthomas/gometalinter.v2 github.com/miekg/exdns/q github.com/namecoin/dns-prop279 go test -v ./... RESULT=$? @@ -12,9 +12,9 @@ fi # Static analysis -gometalinter.v1 --install +gometalinter.v2 --install -# aligncheck is disabled because of these comments: +# maligned is disabled because of these comments: # * https://www.reddit.com/r/golang/comments/3lahav/aligncheck_helps_to_find_inefficiently_packed/cv4u4lg/ # * https://www.reddit.com/r/golang/comments/3lahav/aligncheck_helps_to_find_inefficiently_packed/cv5wnom/ # test is disabled because we already do tests earlier in the script. @@ -22,8 +22,7 @@ gometalinter.v1 --install # verbatim from the Go standard library. echo "" echo "gometalinter critical (should be no warnings):" -gometalinter.v1 --enable-all \ ---disable=aligncheck \ +gometalinter.v2 --enable-all \ --disable=deadcode \ --disable=dupl \ --disable=errcheck \ @@ -33,6 +32,9 @@ gometalinter.v1 --enable-all \ --disable=golint \ --disable=ineffassign \ --disable=lll \ +--disable=maligned \ +--disable=megacheck \ +--disable=nakedret \ --disable=staticcheck \ --disable=test \ --disable=unconvert \ @@ -46,8 +48,8 @@ STATICRESULT1=$? echo "" echo "gometalinter non-critical (warnings expected):" -gometalinter.v1 --enable-all \ ---disable=aligncheck \ +gometalinter.v2 --enable-all \ +--disable=maligned \ --disable=test \ --concurrency=3 \ --deadline=10m \ diff --git a/certdehydrate/certdehydrate_test.go b/certdehydrate/certdehydrate_test.go index fb42e08..5d6e05f 100644 --- a/certdehydrate/certdehydrate_test.go +++ b/certdehydrate/certdehydrate_test.go @@ -2,10 +2,11 @@ package certdehydrate_test import ( "encoding/json" - "github.com/namecoin/ncdns/certdehydrate" - "github.com/namecoin/ncdns/x509" "reflect" "testing" + + "github.com/namecoin/ncdns/certdehydrate" + "github.com/namecoin/ncdns/x509" ) func TestDehydratedCertIdentityOperation(t *testing.T) { diff --git a/certinject/certinject.go b/certinject/certinject.go index c4da3be..28ce0f8 100644 --- a/certinject/certinject.go +++ b/certinject/certinject.go @@ -1,9 +1,12 @@ package certinject import ( + "github.com/hlandau/xlog" "gopkg.in/hlandau/easyconfig.v1/cflag" ) +var log, Log = xlog.New("ncdns.certinject") + var ( flagGroup = cflag.NewGroup(nil, "certstore") nssFlag = cflag.Bool(flagGroup, "nss", false, nssExplain) diff --git a/certinject/certinject_notwindows.go b/certinject/certinject_notwindows.go index ee70a3e..5439eaa 100644 --- a/certinject/certinject_notwindows.go +++ b/certinject/certinject_notwindows.go @@ -2,14 +2,10 @@ package certinject -import "github.com/hlandau/xlog" - // This package is used to add and remove certificates to the system trust // store. // Currently only supports NSS sqlite3 stores. -var log, Log = xlog.New("ncdns.certinject") - // InjectCert injects the given cert into all configured trust stores. func InjectCert(derBytes []byte) { diff --git a/certinject/certinject_windows.go b/certinject/certinject_windows.go index 2670ff6..279d720 100644 --- a/certinject/certinject_windows.go +++ b/certinject/certinject_windows.go @@ -1,7 +1,6 @@ package certinject import ( - "github.com/hlandau/xlog" "gopkg.in/hlandau/easyconfig.v1/cflag" ) @@ -9,8 +8,6 @@ import ( // store. // Currently only supports Windows CryptoAPI and NSS sqlite3 stores. -var log, Log = xlog.New("ncdns.certinject") - var ( cryptoApiFlag = cflag.Bool(flagGroup, "cryptoapi", false, "Synchronize TLS certs to the CryptoAPI trust store? This "+ diff --git a/main.go b/main.go index ad789ef..93305ce 100644 --- a/main.go +++ b/main.go @@ -1,11 +1,12 @@ package main import ( + "path/filepath" + "github.com/hlandau/dexlogconfig" "github.com/namecoin/ncdns/server" "gopkg.in/hlandau/easyconfig.v1" "gopkg.in/hlandau/service.v2" - "path/filepath" ) func main() { diff --git a/ncdomain/convert.go b/ncdomain/convert.go index fafe809..1cd1cd4 100644 --- a/ncdomain/convert.go +++ b/ncdomain/convert.go @@ -1015,8 +1015,6 @@ func parseTXT(rv map[string]interface{}, v *Value, errFunc ErrorFunc) { v.TXT[i] = v.TXT[i][0 : len(v.TXT[i])-1] } } - - return } func segmentizeTXT(txt string) (a []string) { @@ -1073,8 +1071,6 @@ func parseSingleMX(rv map[string]interface{}, s interface{}, v *Value, errFunc E Preference: uint16(prio), Mx: hostname, }) - - return } func parseSRV(rv map[string]interface{}, v *Value, errFunc ErrorFunc, relname string) { @@ -1144,8 +1140,6 @@ func parseSingleService(rv map[string]interface{}, svc interface{}, v *Value, er Port: uint16(port), Target: hostname, }) - - return } func convServiceValue(x interface{}) (string, error) { diff --git a/server/server.go b/server/server.go index 0d0eaf1..276ce42 100644 --- a/server/server.go +++ b/server/server.go @@ -3,17 +3,18 @@ package server import ( "crypto" "fmt" + "net" + "os" + "path/filepath" + "strings" + "sync" + "github.com/hlandau/buildinfo" "github.com/hlandau/xlog" "github.com/miekg/dns" "github.com/namecoin/ncdns/backend" "github.com/namecoin/ncdns/namecoin" "gopkg.in/hlandau/madns.v1" - "net" - "os" - "path/filepath" - "strings" - "sync" ) var log, Log = xlog.New("ncdns.server") diff --git a/tlsrestrictchromium/chromium.go b/tlsrestrictchromium/chromium.go index 2d54794..b61f844 100644 --- a/tlsrestrictchromium/chromium.go +++ b/tlsrestrictchromium/chromium.go @@ -6,8 +6,9 @@ import ( "encoding/hex" "encoding/json" "fmt" - "github.com/miekg/dns" "math/big" + + "github.com/miekg/dns" ) // DNSHash converts an FQDN to DNS wire format, takes the SHA256 of it, and diff --git a/tlsrestrictchromium/chromium_test.go b/tlsrestrictchromium/chromium_test.go index 373f294..d46f7ee 100644 --- a/tlsrestrictchromium/chromium_test.go +++ b/tlsrestrictchromium/chromium_test.go @@ -1,8 +1,9 @@ package tlsrestrictchromium_test import ( - "github.com/namecoin/ncdns/tlsrestrictchromium" "testing" + + "github.com/namecoin/ncdns/tlsrestrictchromium" ) func TestDnsHash(t *testing.T) { diff --git a/tlsrestrictchromium/tlsrestrict_chromium_tool/main.go b/tlsrestrictchromium/tlsrestrict_chromium_tool/main.go index f043a23..fab0414 100644 --- a/tlsrestrictchromium/tlsrestrict_chromium_tool/main.go +++ b/tlsrestrictchromium/tlsrestrict_chromium_tool/main.go @@ -2,11 +2,12 @@ package main import ( "encoding/json" + "io/ioutil" + "log" + "github.com/namecoin/ncdns/tlsrestrictchromium" "gopkg.in/hlandau/easyconfig.v1" "gopkg.in/hlandau/easyconfig.v1/cflag" - "io/ioutil" - "log" ) var (