mirror of
https://github.com/namecoin/ncdns
synced 2024-11-10 01:10:31 +00:00
Merge #77: Travis: various static analysis fixes/improvements
c1f6d2c
ncdomain: fix redundant return statement in parseSingleService. (JeremyRand)a876b17
ncdomain: fix redundant return statement in parseSingleMX. (JeremyRand)40eeed1
ncdomain: fix redundant return statement in parseTXT. (JeremyRand)497faca
goimports -w tlsrestrictchromium/tlsrestrict_chromium_tool/main.go (JeremyRand)a107d33
goimports -w tlsrestrictchromium/chromium_test.go (JeremyRand)056215e
Travis: mark megacheck linter as non-critical. (JeremyRand)91e1ce4
Travis: aligncheck linter is replaced by maligned linter. (JeremyRand)cf97a1a
Travis: mark nakedret linter as non-critical. (JeremyRand)f031d2b
goimports -w tlsrestrictchromium/chromium.go (JeremyRand)5350011
Travis: update gometalinter to v2. (JeremyRand)9b6643d
goimports -w server/server.go (JeremyRand)4c66b15
certinject: Fix duplicated log variable. (JeremyRand)5d508f6
goimports -w certdehydrate/certdehydrate_test.go (JeremyRand)519f47f
goimports -w main.go (JeremyRand) Pull request description: TODO: - [x] Fix any static analysis warnings that this triggers. Tree-SHA512: 4071af04fa08534815b8d14fccc998087d9d9580b2407bea0671e290e370a5e75d608a21d351b7377387e0f4029f870049feaa0adeaef0e99fa3252eef272df7
This commit is contained in:
commit
4cb4768424
@ -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 \
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
||||
|
@ -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 "+
|
||||
|
3
main.go
3
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() {
|
||||
|
@ -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) {
|
||||
|
@ -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")
|
||||
|
@ -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
|
||||
|
@ -1,8 +1,9 @@
|
||||
package tlsrestrictchromium_test
|
||||
|
||||
import (
|
||||
"github.com/namecoin/ncdns/tlsrestrictchromium"
|
||||
"testing"
|
||||
|
||||
"github.com/namecoin/ncdns/tlsrestrictchromium"
|
||||
)
|
||||
|
||||
func TestDnsHash(t *testing.T) {
|
||||
|
@ -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 (
|
||||
|
Loading…
Reference in New Issue
Block a user