aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2020-06-06 05:25:23 +0700
committerShulhan <m.shulhan@gmail.com>2020-06-06 05:25:42 +0700
commitb1133f25df3ec38b503e1ea6129ea6b3397968bb (patch)
tree53a2c6755c6a2e0d9ed13b84603e5b8bcd2e3ee0
parent8661178b08ce640d7c24aec8465802e4d5160e2a (diff)
downloadpakakeh.go-b1133f25df3ec38b503e1ea6129ea6b3397968bb.tar.xz
all: use default linter options
-rw-r--r--Makefile14
-rw-r--r--api/telegram/bot/bot_test.go2
-rw-r--r--api/telegram/bot/passport_data.go1
-rw-r--r--cmd/gofmtcomment/main.go1
-rw-r--r--cmd/smtpcli/client.go1
-rw-r--r--lib/ascii/ascii.go1
-rw-r--r--lib/bytes/bytes_test.go2
-rw-r--r--lib/debug/debug.go2
-rw-r--r--lib/debug/pprof.go1
-rw-r--r--lib/dns/dns.go6
-rw-r--r--lib/dns/dns_test.go1
-rw-r--r--lib/dns/dohclient.go2
-rw-r--r--lib/dns/dohclient_test.go4
-rw-r--r--lib/dns/dotclient.go2
-rw-r--r--lib/dns/idpool.go1
-rw-r--r--lib/dns/masterfile_test.go10
-rw-r--r--lib/dns/message.go2
-rw-r--r--lib/dns/message_test.go20
-rw-r--r--lib/dns/server.go3
-rw-r--r--lib/dns/serveroptions.go1
-rw-r--r--lib/dns/udpclient_test.go2
-rw-r--r--lib/dsv/common_test.go1
-rw-r--r--lib/dsv/data_test.go5
-rw-r--r--lib/dsv/reader_test.go2
-rw-r--r--lib/email/body.go2
-rw-r--r--lib/email/dkim/canon.go1
-rw-r--r--lib/email/dkim/dkim.go2
-rw-r--r--lib/email/dkim/dkim_test.go1
-rw-r--r--lib/email/dkim/dns.go1
-rw-r--r--lib/email/dkim/hashalg.go1
-rw-r--r--lib/email/dkim/key_test.go1
-rw-r--r--lib/email/dkim/keyflag.go1
-rw-r--r--lib/email/dkim/keypool_test.go2
-rw-r--r--lib/email/dkim/keytype.go1
-rw-r--r--lib/email/dkim/queryoption.go1
-rw-r--r--lib/email/dkim/querytype.go1
-rw-r--r--lib/email/dkim/signalg.go1
-rw-r--r--lib/email/dkim/signature.go5
-rw-r--r--lib/email/dkim/signature_test.go2
-rw-r--r--lib/email/dkim/tag.go1
-rw-r--r--lib/email/email.go1
-rw-r--r--lib/email/email_test.go1
-rw-r--r--lib/email/field.go3
-rw-r--r--lib/email/fieldtype.go1
-rw-r--r--lib/email/is.go1
-rw-r--r--lib/email/mailbox.go1
-rw-r--r--lib/email/maildir/manager.go2
-rw-r--r--lib/email/message_test.go1
-rw-r--r--lib/email/param.go1
-rw-r--r--lib/floats64/floats64_test.go4
-rw-r--r--lib/git/git.go1
-rw-r--r--lib/git/git_test.go1
-rw-r--r--lib/http/client.go2
-rw-r--r--lib/http/http_test.go1
-rw-r--r--lib/http/response_test.go2
-rw-r--r--lib/http/server_test.go3
-rw-r--r--lib/hunspell/hunspell.go2
-rw-r--r--lib/hunspell/options.go2
-rw-r--r--lib/ini/ini.go1
-rw-r--r--lib/ini/ini_test.go1
-rw-r--r--lib/ints/ints_test.go4
-rw-r--r--lib/ints64/ints64_test.go4
-rw-r--r--lib/json/json_test.go4
-rw-r--r--lib/math/big/big.go1
-rw-r--r--lib/math/big/float.go2
-rw-r--r--lib/math/big/rat.go1
-rw-r--r--lib/memfs/generate_test/memfs_generate_test.go2
-rw-r--r--lib/memfs/memfs.go1
-rw-r--r--lib/memfs/memfs_test.go1
-rw-r--r--lib/mining/classifier/rf/rf_test.go1
-rw-r--r--lib/mining/dict.go5
-rw-r--r--lib/mining/gain/gini/gini_test.go1
-rw-r--r--lib/mining/knn/neighbor_test.go1
-rw-r--r--lib/net/resolvconf.go1
-rw-r--r--lib/reflect/reflect.go1
-rw-r--r--lib/runes/runes_test.go1
-rw-r--r--lib/smtp/client.go4
-rw-r--r--lib/smtp/command.go2
-rw-r--r--lib/smtp/extension.go1
-rw-r--r--lib/smtp/mail.go1
-rw-r--r--lib/smtp/server.go1
-rw-r--r--lib/smtp/smtp_test.go1
-rw-r--r--lib/spf/spf.go2
-rw-r--r--lib/sql/table.go1
-rw-r--r--lib/ssh/client.go4
-rw-r--r--lib/ssh/config.go3
-rw-r--r--lib/ssh/config_parser_test.go2
-rw-r--r--lib/ssh/ssh_test.go1
-rw-r--r--lib/strings/statistic_test.go2
-rw-r--r--lib/strings/string_test.go1
-rw-r--r--lib/strings/wikimarkup.go1
-rw-r--r--lib/tabula/dataset_test.go1
-rw-r--r--lib/tabula/tabula_test.go1
-rw-r--r--lib/test/mock/mock.go1
-rw-r--r--lib/text/diff/diff.go1
-rw-r--r--lib/text/diff/diff_test.go3
-rw-r--r--lib/text/diff/diffinterface.go1
-rw-r--r--lib/time/time.go1
-rw-r--r--lib/websocket/client.go2
-rw-r--r--lib/websocket/frame_test.go4
-rw-r--r--lib/websocket/funcs.go4
-rw-r--r--lib/websocket/handshake.go2
-rw-r--r--lib/websocket/request.go1
-rw-r--r--lib/websocket/response.go1
-rw-r--r--lib/websocket/rootroute_test.go3
-rw-r--r--lib/websocket/server_bench_test.go3
-rw-r--r--lib/websocket/websocket.go4
-rw-r--r--lib/websocket/websocket_test.go1
-rw-r--r--lib/xmlrpc/client.go4
109 files changed, 52 insertions, 187 deletions
diff --git a/Makefile b/Makefile
index 4dba86b8..e02e422f 100644
--- a/Makefile
+++ b/Makefile
@@ -43,20 +43,10 @@ coverbrowse: $(COVER_HTML)
xdg-open $<
lint:
- -golangci-lint run --enable-all \
- --disable=dupl \
- --disable=funlen \
- --disable=godox \
- --disable=gomnd \
- --disable=wsl \
- --disable=gocognit \
- --disable=testpackage \
- --disable=nestif \
- --disable=goerr113 \
- ./...
+ -golangci-lint run ./...
genhtml:
- ciigo -template=html.tmpl convert _doc/
+ ciigo convert _doc/
clean:
rm -f $(COVER_OUT) $(COVER_HTML)
diff --git a/api/telegram/bot/bot_test.go b/api/telegram/bot/bot_test.go
index cdf40d92..365e5e84 100644
--- a/api/telegram/bot/bot_test.go
+++ b/api/telegram/bot/bot_test.go
@@ -15,7 +15,7 @@ const (
)
var (
- testBot *Bot //nolint: gochecknoglobals
+ testBot *Bot
)
func TestMain(m *testing.M) {
diff --git a/api/telegram/bot/passport_data.go b/api/telegram/bot/passport_data.go
index 526cec4e..cefaf14a 100644
--- a/api/telegram/bot/passport_data.go
+++ b/api/telegram/bot/passport_data.go
@@ -7,6 +7,7 @@ package bot
//
// PassportData contains information about Telegram Passport data shared with
// the bot by the user.
+//
type PassportData struct {
// Array with information about documents and other Telegram Passport
// elements that was shared with the bot.
diff --git a/cmd/gofmtcomment/main.go b/cmd/gofmtcomment/main.go
index 3d17ee30..0511a8b1 100644
--- a/cmd/gofmtcomment/main.go
+++ b/cmd/gofmtcomment/main.go
@@ -19,7 +19,6 @@ const (
gapb = byte(' ')
)
-//nolint:gochecknoglobals
var (
twoGaps = []byte{gapb, gapb}
threeGaps = []byte{gapb, gapb, gapb}
diff --git a/cmd/smtpcli/client.go b/cmd/smtpcli/client.go
index 7d003e61..d3cb12bc 100644
--- a/cmd/smtpcli/client.go
+++ b/cmd/smtpcli/client.go
@@ -14,7 +14,6 @@ import (
"github.com/shuLhan/share/lib/smtp"
)
-//nolint:gochecknoglobals
var (
stdin = os.Stdin
stdout = os.Stdout
diff --git a/lib/ascii/ascii.go b/lib/ascii/ascii.go
index 314c3a53..6a3f1874 100644
--- a/lib/ascii/ascii.go
+++ b/lib/ascii/ascii.go
@@ -26,7 +26,6 @@ const (
Hexaletters = "0123456789abcedf"
)
-//nolint:gochecknoglobals
var (
// Spaces contains list of white spaces in ASCII.
Spaces = []byte{'\t', '\n', '\v', '\f', '\r', ' '}
diff --git a/lib/bytes/bytes_test.go b/lib/bytes/bytes_test.go
index 14592bfb..2f8df54d 100644
--- a/lib/bytes/bytes_test.go
+++ b/lib/bytes/bytes_test.go
@@ -85,7 +85,7 @@ func TestCutUntilToken(t *testing.T) {
}
}
-func TestEncloseRemove(t *testing.T) { //nolint:dupl
+func TestEncloseRemove(t *testing.T) {
line := []byte(`// Copyright 2016-2018 "Shulhan <ms@kilabit.info>". All rights reserved.`)
cases := []struct {
diff --git a/lib/debug/debug.go b/lib/debug/debug.go
index 814e41a6..8b2f335e 100644
--- a/lib/debug/debug.go
+++ b/lib/debug/debug.go
@@ -11,7 +11,6 @@ import (
"strconv"
)
-//nolint:gochecknoglobals
var (
// Value contains DEBUG value from environment.
Value = 0
@@ -20,7 +19,6 @@ var (
//
// init initialize debug from system environment.
//
-//nolint:gochecknoinits
func init() {
v := os.Getenv("DEBUG")
if len(v) > 0 {
diff --git a/lib/debug/pprof.go b/lib/debug/pprof.go
index f292a993..05b60466 100644
--- a/lib/debug/pprof.go
+++ b/lib/debug/pprof.go
@@ -12,7 +12,6 @@ import (
"runtime/pprof"
)
-//nolint:gochecknoglobals
var prof *profile
type profile struct {
diff --git a/lib/dns/dns.go b/lib/dns/dns.go
index 9e77754a..7a974c81 100644
--- a/lib/dns/dns.go
+++ b/lib/dns/dns.go
@@ -62,7 +62,6 @@ var (
ErrIPv6Length = errors.New("invalid length of AAAA RDATA format")
)
-//nolint:gochecknoglobals
var (
// clientTimeout define read and write timeout on client request.
clientTimeout = 6 * time.Second
@@ -81,7 +80,6 @@ const (
//
// connTypeNames contains a mapping between connection type and its name.
//
-//nolint:gochecknoglobals
var connTypeNames = map[connType]string{
connTypeUDP: "UDP",
connTypeTCP: "TCP",
@@ -131,7 +129,6 @@ const (
// QueryTypes contains a mapping between string representation of DNS query
// type with their decimal value.
//
-//nolint:gochecknoglobals
var QueryTypes = map[string]uint16{
"A": QueryTypeA,
"NS": QueryTypeNS,
@@ -156,7 +153,6 @@ var QueryTypes = map[string]uint16{
// QueryTypeNames contains mapping between query type and and their string
// representation.
//
-//nolint:gochecknoglobals
var QueryTypeNames = map[uint16]string{
QueryTypeA: "A",
QueryTypeNS: "NS",
@@ -191,7 +187,6 @@ const (
// QueryClasses contains a mapping between string representation of DNS query
// class with their decimal value.
//
-//nolint:gochecknoglobals
var QueryClasses = map[string]uint16{
"IN": QueryClassIN,
"CH": QueryClassCH,
@@ -233,7 +228,6 @@ const (
// rcodeNames contains mapping of response code with their human readable
// names.
//
-//nolint:gochecknoglobals
var rcodeNames = map[ResponseCode]string{
RCodeOK: "OK",
RCodeErrFormat: "ERR_FORMAT",
diff --git a/lib/dns/dns_test.go b/lib/dns/dns_test.go
index 654f6ff5..918a242b 100644
--- a/lib/dns/dns_test.go
+++ b/lib/dns/dns_test.go
@@ -19,7 +19,6 @@ const (
testTLSPort = 8053
)
-//nolint:gochecknoglobals
var (
_testServer *Server
)
diff --git a/lib/dns/dohclient.go b/lib/dns/dohclient.go
index fca22ca7..4cdaee2f 100644
--- a/lib/dns/dohclient.go
+++ b/lib/dns/dohclient.go
@@ -50,7 +50,7 @@ func NewDoHClient(nameserver string, allowInsecure bool) (*DoHClient, error) {
MaxIdleConns: 1,
IdleConnTimeout: 30 * time.Second,
TLSClientConfig: &tls.Config{
- InsecureSkipVerify: allowInsecure, //nolint:gosec
+ InsecureSkipVerify: allowInsecure,
},
}
diff --git a/lib/dns/dohclient_test.go b/lib/dns/dohclient_test.go
index 81a9a905..39e02d36 100644
--- a/lib/dns/dohclient_test.go
+++ b/lib/dns/dohclient_test.go
@@ -18,7 +18,7 @@ func TestDoHClient_Lookup(t *testing.T) {
t.Fatal(err)
}
- cases := []struct { //nolint:dupl
+ cases := []struct {
desc string
allowRecursion bool
qtype uint16
@@ -163,7 +163,7 @@ func TestDoHClient_Post(t *testing.T) {
t.Fatal(err)
}
- cases := []struct { //nolint:dupl
+ cases := []struct {
desc string
allowRecursion bool
qtype uint16
diff --git a/lib/dns/dotclient.go b/lib/dns/dotclient.go
index 8baaf755..f356d094 100644
--- a/lib/dns/dotclient.go
+++ b/lib/dns/dotclient.go
@@ -41,7 +41,7 @@ func NewDoTClient(nameserver string, allowInsecure bool) (cl *DoTClient, err err
nameserver = fmt.Sprintf("%s:%d", remoteIP, port)
tlsConfig := tls.Config{
- InsecureSkipVerify: allowInsecure, //nolint: gosec
+ InsecureSkipVerify: allowInsecure,
}
cl.conn, err = tls.Dial("tcp", nameserver, &tlsConfig)
diff --git a/lib/dns/idpool.go b/lib/dns/idpool.go
index 689dcb9a..7342e66b 100644
--- a/lib/dns/idpool.go
+++ b/lib/dns/idpool.go
@@ -8,7 +8,6 @@ import (
"sync/atomic"
)
-//nolint:gochecknoglobals
var idPool uint32
//
diff --git a/lib/dns/masterfile_test.go b/lib/dns/masterfile_test.go
index fff80ba7..254eab77 100644
--- a/lib/dns/masterfile_test.go
+++ b/lib/dns/masterfile_test.go
@@ -320,7 +320,7 @@ VAXA A 10.2.0.27
m := newMaster()
- for _, c := range cases { //nolint:dupl
+ for _, c := range cases {
t.Log(c.desc)
m.Init(c.in, c.origin, c.ttl)
@@ -333,7 +333,6 @@ VAXA A 10.2.0.27
libtest.Assert(t, "messages length:", len(c.exp), len(m.msgs), true)
- //nolint:dupl
for x, msg := range m.msgs {
libtest.Assert(t, "Message.Header", c.exp[x].Header, msg.Header, true)
libtest.Assert(t, "Message.Question", c.exp[x].Question, msg.Question, true)
@@ -578,7 +577,7 @@ relay IN CNAME relay.pair.com.
m := newMaster()
- for _, c := range cases { //nolint:dupl
+ for _, c := range cases {
t.Log(c.desc)
m.Init(c.in, c.origin, c.ttl)
@@ -591,7 +590,6 @@ relay IN CNAME relay.pair.com.
libtest.Assert(t, "messages length:", len(c.exp), len(m.msgs), true)
- //nolint:dupl
for x, msg := range m.msgs {
libtest.Assert(t, "Message.Header", c.exp[x].Header, msg.Header, true)
libtest.Assert(t, "Message.Question", c.exp[x].Question, msg.Question, true)
@@ -699,7 +697,7 @@ angularjs.doc A 127.0.0.1
m := newMaster()
- for _, c := range cases { //nolint:dupl
+ for _, c := range cases {
t.Log(c.desc)
m.Init(c.in, c.origin, c.ttl)
@@ -712,7 +710,6 @@ angularjs.doc A 127.0.0.1
libtest.Assert(t, "messages length:", len(c.exp), len(m.msgs), true)
- //nolint:dupl
for x, msg := range m.msgs {
libtest.Assert(t, "Message.Header", c.exp[x].Header, msg.Header, true)
libtest.Assert(t, "Message.Question", c.exp[x].Question, msg.Question, true)
@@ -783,7 +780,6 @@ func TestMasterParseTXT(t *testing.T) {
libtest.Assert(t, "messages length:", len(c.exp), len(m.msgs), true)
- //nolint:dupl
for x, msg := range m.msgs {
libtest.Assert(t, "Message.Header", c.exp[x].Header, msg.Header, true)
libtest.Assert(t, "Message.Question", c.exp[x].Question, msg.Question, true)
diff --git a/lib/dns/message.go b/lib/dns/message.go
index a6378cdc..289fa0cd 100644
--- a/lib/dns/message.go
+++ b/lib/dns/message.go
@@ -48,7 +48,7 @@ import (
//
// [1] RFC 1035 - 4.1. Format
//
-type Message struct { //nolint: maligned
+type Message struct {
Header SectionHeader
Question SectionQuestion
Answer []ResourceRecord
diff --git a/lib/dns/message_test.go b/lib/dns/message_test.go
index 6b161f81..166d8f92 100644
--- a/lib/dns/message_test.go
+++ b/lib/dns/message_test.go
@@ -420,7 +420,7 @@ func TestMessagePack(t *testing.T) {
},
}, {
desc: "Response with MX RDATA",
- exp: []byte{ //nolint:dupl
+ exp: []byte{
0x9e, 0xef, 0x81, 0x80,
0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01,
// Question
@@ -543,7 +543,7 @@ func TestMessagePack(t *testing.T) {
},
}, {
desc: "Response with TXT RDATA",
- exp: []byte{ //nolint:dupl
+ exp: []byte{
0x3f, 0x7d, 0x81, 0x80, 0x00, 0x01, 0x00, 0x03,
0x00, 0x00, 0x00, 0x01, 0x06, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00,
@@ -664,7 +664,7 @@ func TestMessagePack(t *testing.T) {
},
}, {
desc: "Response with SRV RDATA",
- exp: []byte{ //nolint:dupl
+ exp: []byte{
0x2c, 0xb4,
0x81, 0x80,
0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01,
@@ -905,7 +905,6 @@ func TestMessageSetAuthoritativeAnswer(t *testing.T) {
}
}
-//nolint:dupl
func TestMessageSetQuery(t *testing.T) {
msgQuery := &Message{
Header: SectionHeader{
@@ -949,7 +948,6 @@ func TestMessageSetQuery(t *testing.T) {
}
}
-//nolint:dupl
func TestMessageSetRecursionDesired(t *testing.T) {
msgQuery := &Message{
Header: SectionHeader{
@@ -1318,7 +1316,7 @@ func TestMessageUnpack(t *testing.T) {
},
}, {
desc: "RR with MX",
- packet: []byte{ //nolint:dupl
+ packet: []byte{
0x9e, 0xef, 0x81, 0x80,
0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01,
// Question
@@ -1473,7 +1471,7 @@ func TestMessageUnpack(t *testing.T) {
},
}, {
desc: "RR with TXT",
- packet: []byte{ //nolint:dupl
+ packet: []byte{
0x3f, 0x7d, 0x81, 0x80,
0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01,
// Question
@@ -1648,7 +1646,7 @@ func TestMessageUnpack(t *testing.T) {
},
}, {
desc: "RR with SRV",
- packet: []byte{ //nolint:dupl
+ packet: []byte{
0x2c, 0xb4,
0x81, 0x80,
0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01,
@@ -1875,7 +1873,7 @@ func TestMessageUnpack(t *testing.T) {
test.Assert(t, "Authority Length", len(c.exp.Authority), len(msg.Authority), true)
test.Assert(t, "Additional Length", len(c.exp.Additional), len(msg.Additional), true)
- for x := 0; x < len(c.exp.Answer); x++ { //nolint:dupl
+ for x := 0; x < len(c.exp.Answer); x++ {
test.Assert(t, "Answer.Name", c.exp.Answer[x].Name, msg.Answer[x].Name, true)
test.Assert(t, "Answer.Type", c.exp.Answer[x].Type, msg.Answer[x].Type, true)
test.Assert(t, "Answer.Class", c.exp.Answer[x].Class, msg.Answer[x].Class, true)
@@ -1884,7 +1882,7 @@ func TestMessageUnpack(t *testing.T) {
test.Assert(t, "Answer.rdata", c.exp.Answer[x].rdata, msg.Answer[x].rdata, true)
test.Assert(t, "Answer.RData()", c.exp.Answer[x].RData(), msg.Answer[x].RData(), true)
}
- for x := 0; x < len(c.exp.Authority); x++ { //nolint:dupl
+ for x := 0; x < len(c.exp.Authority); x++ {
test.Assert(t, "Authority.Name", c.exp.Authority[x].Name, msg.Authority[x].Name, true)
test.Assert(t, "Authority.Type", c.exp.Authority[x].Type, msg.Authority[x].Type, true)
test.Assert(t, "Authority.Class", c.exp.Authority[x].Class, msg.Authority[x].Class, true)
@@ -1893,7 +1891,7 @@ func TestMessageUnpack(t *testing.T) {
test.Assert(t, "Authority.rdata", c.exp.Authority[x].rdata, msg.Authority[x].rdata, true)
test.Assert(t, "Authority.RData()", c.exp.Authority[x].RData(), msg.Authority[x].RData(), true)
}
- for x := 0; x < len(c.exp.Additional); x++ { //nolint:dupl
+ for x := 0; x < len(c.exp.Additional); x++ {
test.Assert(t, "Additional.Name", c.exp.Additional[x].Name, msg.Additional[x].Name, true)
test.Assert(t, "Additional.Type", c.exp.Additional[x].Type, msg.Additional[x].Type, true)
test.Assert(t, "Additional.Class", c.exp.Additional[x].Class, msg.Additional[x].Class, true)
diff --git a/lib/dns/server.go b/lib/dns/server.go
index 01dfb00e..5e5910e0 100644
--- a/lib/dns/server.go
+++ b/lib/dns/server.go
@@ -136,7 +136,7 @@ func NewServer(opts *ServerOptions) (srv *Server, err error) {
Certificates: []tls.Certificate{
cert,
},
- InsecureSkipVerify: opts.TLSAllowInsecure, //nolint:gosec
+ InsecureSkipVerify: opts.TLSAllowInsecure,
}
}
@@ -1021,7 +1021,6 @@ func (srv *Server) runUDPForwarder(isPrimary bool, tag, nameserver string,
}
}
-//nolint: interfacer
func (srv *Server) stopForwarder(isPrimary bool, fw Client) {
if fw != nil {
fw.Close()
diff --git a/lib/dns/serveroptions.go b/lib/dns/serveroptions.go
index ae0a8410..496a3a0a 100644
--- a/lib/dns/serveroptions.go
+++ b/lib/dns/serveroptions.go
@@ -17,7 +17,6 @@ import (
//
// ServerOptions describes options for running a DNS server.
//
-//nolint:maligned
type ServerOptions struct {
// ListenAddress ip address and port number to serve query.
// This field is optional, default to "0.0.0.0:53".
diff --git a/lib/dns/udpclient_test.go b/lib/dns/udpclient_test.go
index ac3ebfe0..54ba0e93 100644
--- a/lib/dns/udpclient_test.go
+++ b/lib/dns/udpclient_test.go
@@ -16,7 +16,7 @@ func TestUDPClientLookup(t *testing.T) {
t.Fatal(err)
}
- cases := []struct { //nolint:dupl
+ cases := []struct {
desc string
allowRecursion bool
qtype uint16
diff --git a/lib/dsv/common_test.go b/lib/dsv/common_test.go
index 483ac533..89321ea1 100644
--- a/lib/dsv/common_test.go
+++ b/lib/dsv/common_test.go
@@ -106,7 +106,6 @@ func doReadWrite(t *testing.T, dsvReader *Reader, dsvWriter *Writer,
}
}
-//nolint:gochecknoglobals
var (
datasetRows = [][]string{
{"0", "1", "A"},
diff --git a/lib/dsv/data_test.go b/lib/dsv/data_test.go
index 9205c6a8..41f6cf7a 100644
--- a/lib/dsv/data_test.go
+++ b/lib/dsv/data_test.go
@@ -4,7 +4,6 @@
package dsv
-//nolint:gochecknoglobals
var expectation = []string{
"&[1 A-B AB 1 0.1]",
"&[2 A-B-C BCD 2 0.02]",
@@ -18,7 +17,6 @@ var expectation = []string{
"&[14 string with\" quote string with]] escape 14 14]",
}
-//nolint:gochecknoglobals
var expSkip = []string{
"&[A-B AB 1 0.1]",
"&[A-B-C BCD 2 0.02]",
@@ -32,7 +30,6 @@ var expSkip = []string{
"&[string with\" quote string with]] escape 14 14]",
}
-//nolint:lll,gochecknoglobals
var expSkipColumns = []string{
"[{name 0 0 [] [A-B]} {value 0 0 [] [AB]} {integer 1 0 [] [1]} {real 2 0 [] [0.1]}]",
"[{name 0 0 [] [A-B-C]} {value 0 0 [] [BCD]} {integer 1 0 [] [2]} {real 2 0 [] [0.02]}]",
@@ -46,7 +43,6 @@ var expSkipColumns = []string{
"[{name 0 0 [] [string with\" quote]} {value 0 0 [] [string with]] escape]} {integer 1 0 [] [14]} {real 2 0 [] [14]}]",
}
-//nolint:lll,gochecknoglobals
var expSkipColumnsAll = []string{
"{name 0 0 [] [A-B A-B-C A;B-C,D A;B-C,D ok test test string with string with\" quote]}",
"{value 0 0 [] [AB BCD A;B C,D A;B C D missing right-quote];8;0.00000008\n9;\"ok\"-[[ok integer real string with string with]] escape]}",
@@ -54,7 +50,6 @@ var expSkipColumnsAll = []string{
"{real 2 0 [] [0.1 0.02 0.003 0.0004 0.000006 0.000000009 0.101 0.123456789 13 14]}",
}
-//nolint:lll,gochecknoglobals
var expSkipColumnsAllRev = []string{
"{name 0 0 [] [string with\" quote string with test test ok A;B-C,D A;B-C,D A-B-C A-B]}",
"{value 0 0 [] [string with]] escape string with real integer missing right-quote];8;0.00000008\n9;\"ok\"-[[ok A;B C D A;B C,D BCD AB]}",
diff --git a/lib/dsv/reader_test.go b/lib/dsv/reader_test.go
index fbf872cd..308ac757 100644
--- a/lib/dsv/reader_test.go
+++ b/lib/dsv/reader_test.go
@@ -14,7 +14,6 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint:gochecknoglobals
var jsonSample = []string{
`{}`,
`{
@@ -89,7 +88,6 @@ var jsonSample = []string{
}`,
}
-//nolint:gochecknoglobals
var readers = []*Reader{
{},
{
diff --git a/lib/email/body.go b/lib/email/body.go
index d81104ee..475ef3bf 100644
--- a/lib/email/body.go
+++ b/lib/email/body.go
@@ -124,7 +124,7 @@ func (body *Body) String() string {
// This function is expensive for message with large body, its better if we
// call it once and store it somewhere.
//
-func (body *Body) Relaxed() (out []byte) { //nolint: gocognit
+func (body *Body) Relaxed() (out []byte) {
if len(body.raw) == 0 {
return
}
diff --git a/lib/email/dkim/canon.go b/lib/email/dkim/canon.go
index c4fd1140..c55571b8 100644
--- a/lib/email/dkim/canon.go
+++ b/lib/email/dkim/canon.go
@@ -26,7 +26,6 @@ const (
// canonNames contains mapping between canonical type and their human
// readabale names.
//
-//nolint:gochecknoglobals
var canonNames = map[Canon][]byte{
CanonSimple: []byte("simple"),
CanonRelaxed: []byte("relaxed"),
diff --git a/lib/email/dkim/dkim.go b/lib/email/dkim/dkim.go
index 2214482f..2b511cdf 100644
--- a/lib/email/dkim/dkim.go
+++ b/lib/email/dkim/dkim.go
@@ -14,7 +14,6 @@ import (
// If its not empty, the public key lookup using DNS/TXT will use this values;
// otherwise it will try to use the system name servers.
//
-//nolint:gochecknoglobals
var DefaultNameServers []string
//
@@ -24,7 +23,6 @@ var DefaultNameServers []string
// instead of LookupKey to minimize network traffic and process to decode and
// parse public key.
//
-//nolint:gochecknoglobals
var (
DefaultKeyPool = &KeyPool{
pool: make(map[string]*Key),
diff --git a/lib/email/dkim/dkim_test.go b/lib/email/dkim/dkim_test.go
index 719b3778..07b9505e 100644
--- a/lib/email/dkim/dkim_test.go
+++ b/lib/email/dkim/dkim_test.go
@@ -13,7 +13,6 @@ import (
"time"
)
-//nolint:gochecknoglobals
var (
privateKey *rsa.PrivateKey
publicKey *rsa.PublicKey
diff --git a/lib/email/dkim/dns.go b/lib/email/dkim/dns.go
index 1aa86089..115f1388 100644
--- a/lib/email/dkim/dns.go
+++ b/lib/email/dkim/dns.go
@@ -11,7 +11,6 @@ import (
"github.com/shuLhan/share/lib/dns"
)
-//nolint:gochecknoglobals
var dnsClientPool *dns.UDPClientPool
func newDNSClientPool() (err error) {
diff --git a/lib/email/dkim/hashalg.go b/lib/email/dkim/hashalg.go
index 28edfb02..787d6338 100644
--- a/lib/email/dkim/hashalg.go
+++ b/lib/email/dkim/hashalg.go
@@ -25,7 +25,6 @@ const (
//
// hashAlgNames contains mapping between type value and their names.
//
-//nolint:gochecknoglobals
var hashAlgNames = map[HashAlg][]byte{
HashAlgSHA256: []byte("sha256"),
HashAlgSHA1: []byte("sha1"),
diff --git a/lib/email/dkim/key_test.go b/lib/email/dkim/key_test.go
index 1dc4af0f..156259e4 100644
--- a/lib/email/dkim/key_test.go
+++ b/lib/email/dkim/key_test.go
@@ -11,7 +11,6 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint:lll
func TestKeyLookupKey(t *testing.T) {
qmethod := QueryMethod{}
diff --git a/lib/email/dkim/keyflag.go b/lib/email/dkim/keyflag.go
index deef7914..743a22c2 100644
--- a/lib/email/dkim/keyflag.go
+++ b/lib/email/dkim/keyflag.go
@@ -30,7 +30,6 @@ const (
// keyFlagNames contains mapping between key flag and their text
// representation.
//
-//nolint:gochecknoglobals
var keyFlagNames = map[KeyFlag]byte{
KeyFlagTesting: 'y',
KeyFlagStrict: 's',
diff --git a/lib/email/dkim/keypool_test.go b/lib/email/dkim/keypool_test.go
index b62b4fa4..47813759 100644
--- a/lib/email/dkim/keypool_test.go
+++ b/lib/email/dkim/keypool_test.go
@@ -85,7 +85,7 @@ func TestKeyPoolGet(t *testing.T) {
expErr: "dkim: LookupKey: multiple TXT records on 'amazon.com'",
}, {
dname: "ug7nbtf4gccmlpwj322ax3p6ow6yfsug._domainkey.amazonses.com",
- exp: "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCKkjP6XucgQ06cVZ89Ue/sQDu4v1/AJVd6mMK4bS2YmXk5PzWw4KWtWNUZlg77hegAChx1pG85lUbJ+x4awp28VXqRi3/jZoC6W+3ELysDvVohZPMRMadc+KVtyTiTH4BL38/8ZV9zkj4ZIaaYyiLAiYX+c3+lZQEF3rKDptRcpwIDAQAB", //nolint:lll
+ exp: "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCKkjP6XucgQ06cVZ89Ue/sQDu4v1/AJVd6mMK4bS2YmXk5PzWw4KWtWNUZlg77hegAChx1pG85lUbJ+x4awp28VXqRi3/jZoC6W+3ELysDvVohZPMRMadc+KVtyTiTH4BL38/8ZV9zkj4ZIaaYyiLAiYX+c3+lZQEF3rKDptRcpwIDAQAB",
}}
for _, c := range cases {
diff --git a/lib/email/dkim/keytype.go b/lib/email/dkim/keytype.go
index 246abed3..310badc6 100644
--- a/lib/email/dkim/keytype.go
+++ b/lib/email/dkim/keytype.go
@@ -24,7 +24,6 @@ const (
// keyTypeNames contains mapping between key type and their text
// representation.
//
-//nolint:gochecknoglobals
var keyTypeNames = map[KeyType][]byte{
KeyTypeRSA: []byte("rsa"),
}
diff --git a/lib/email/dkim/queryoption.go b/lib/email/dkim/queryoption.go
index c73eb8e9..8131b339 100644
--- a/lib/email/dkim/queryoption.go
+++ b/lib/email/dkim/queryoption.go
@@ -20,7 +20,6 @@ const (
// queryOptionNames contains a mapping between query option and their text
// representation.
//
-//nolint:gochecknoglobals
var queryOptionNames = map[QueryOption][]byte{
QueryOptionTXT: []byte("txt"),
}
diff --git a/lib/email/dkim/querytype.go b/lib/email/dkim/querytype.go
index 358236c6..e676c33b 100644
--- a/lib/email/dkim/querytype.go
+++ b/lib/email/dkim/querytype.go
@@ -20,7 +20,6 @@ const (
// queryTypeNames contains a mapping betweend query type and their text
// representation.
//
-//nolint:gochecknoglobals
var queryTypeNames = map[QueryType][]byte{
QueryTypeDNS: []byte("dns"),
}
diff --git a/lib/email/dkim/signalg.go b/lib/email/dkim/signalg.go
index 9a126e65..895e897c 100644
--- a/lib/email/dkim/signalg.go
+++ b/lib/email/dkim/signalg.go
@@ -20,7 +20,6 @@ const (
//
// signAlgNames contains mapping between known algorithm type and their names.
//
-//nolint:gochecknoglobals
var signAlgNames = map[SignAlg][]byte{
SignAlgRS256: []byte("rsa-sha256"),
SignAlgRS1: []byte("rsa-sha1"),
diff --git a/lib/email/dkim/signature.go b/lib/email/dkim/signature.go
index 9378ac0d..b7735738 100644
--- a/lib/email/dkim/signature.go
+++ b/lib/email/dkim/signature.go
@@ -9,7 +9,7 @@ import (
"crypto"
"crypto/rand"
"crypto/rsa"
- "crypto/sha1" //nolint:gosec
+ "crypto/sha1"
"crypto/sha256"
"encoding/base64"
"errors"
@@ -161,7 +161,7 @@ func (sig *Signature) Hash(in []byte) (h, h64 []byte) {
h256 := sha256.Sum256(in)
h = h256[:]
} else {
- h1 := sha1.Sum(in) //nolint:gosec
+ h1 := sha1.Sum(in)
h = h1[:]
}
@@ -244,7 +244,6 @@ func (sig *Signature) Pack(simple bool) []byte {
return bb.Bytes()
}
-//nolint:interfacer
func wrap(bb *bytes.Buffer, simple bool) {
if simple {
bb.WriteByte('\r')
diff --git a/lib/email/dkim/signature_test.go b/lib/email/dkim/signature_test.go
index bd7da997..606e168a 100644
--- a/lib/email/dkim/signature_test.go
+++ b/lib/email/dkim/signature_test.go
@@ -276,7 +276,6 @@ func TestSignatureHash(t *testing.T) {
}
}
-//nolint:lll
func TestSignatureSign(t *testing.T) {
if privateKey == nil {
initKeys(t)
@@ -492,7 +491,6 @@ func TestSignatureValidate(t *testing.T) {
}
}
-//nolint:lll
func TestSignatureVerify(t *testing.T) {
if publicKey == nil {
initKeys(t)
diff --git a/lib/email/dkim/tag.go b/lib/email/dkim/tag.go
index 847b60bc..56b06f01 100644
--- a/lib/email/dkim/tag.go
+++ b/lib/email/dkim/tag.go
@@ -64,7 +64,6 @@ const (
//
// Mapping between tag key in numeric and their human readable form.
//
-//nolint:gochecknoglobals
var tagKeys = map[tagKey][]byte{
tagVersion: []byte("v"),
tagAlg: []byte("a"),
diff --git a/lib/email/email.go b/lib/email/email.go
index 7c72cdb4..4471a39e 100644
--- a/lib/email/email.go
+++ b/lib/email/email.go
@@ -17,5 +17,4 @@ const (
lf byte = '\n'
)
-//nolint:gochecknoglobals
var boundSeps = []byte{'-', '-'}
diff --git a/lib/email/email_test.go b/lib/email/email_test.go
index 799e250f..c0ff81ea 100644
--- a/lib/email/email_test.go
+++ b/lib/email/email_test.go
@@ -15,7 +15,6 @@ import (
"github.com/shuLhan/share/lib/email/dkim"
)
-//nolint:gochecknoglobals
var (
privateKey *rsa.PrivateKey
publicKey *rsa.PublicKey
diff --git a/lib/email/field.go b/lib/email/field.go
index 54d85913..a57a7ba0 100644
--- a/lib/email/field.go
+++ b/lib/email/field.go
@@ -53,7 +53,6 @@ type Field struct {
// On error, it will return nil Field, and rest will contains the beginning of
// invalid input.
//
-//nolint:gocyclo
func ParseField(raw []byte) (field *Field, rest []byte, err error) {
if len(raw) == 0 {
return nil, nil, nil
@@ -325,7 +324,7 @@ func (field *Field) updateType() {
// second = 2DIGIT
// zone = ("+" / "-") 4DIGIT
//
-func (field *Field) unpackDate() (err error) { //nolint: gocognit
+func (field *Field) unpackDate() (err error) {
var (
v []byte
ok bool
diff --git a/lib/email/fieldtype.go b/lib/email/fieldtype.go
index f2e09463..53710865 100644
--- a/lib/email/fieldtype.go
+++ b/lib/email/fieldtype.go
@@ -56,7 +56,6 @@ const (
//
// fieldNames contains mapping between field type and their lowercase name.
//
-//nolint:gochecknoglobals
var fieldNames = map[FieldType][]byte{
FieldTypeDate: []byte("date"),
diff --git a/lib/email/is.go b/lib/email/is.go
index 79e4e2e0..8bfb09d3 100644
--- a/lib/email/is.go
+++ b/lib/email/is.go
@@ -4,7 +4,6 @@
package email
-//nolint:gochecknoglobals
var specialChars = map[byte]struct{}{
'(': {}, ')': {},
'<': {}, '>': {},
diff --git a/lib/email/mailbox.go b/lib/email/mailbox.go
index f818be00..b8ec2793 100644
--- a/lib/email/mailbox.go
+++ b/lib/email/mailbox.go
@@ -97,7 +97,6 @@ func ParseMailbox(raw []byte) (mbox *Mailbox, err error) {
//
// "(" text [comment] ")"
//
-//nolint:gocyclo
func ParseMailboxes(raw []byte) (mboxes []*Mailbox, err error) {
raw = bytes.TrimSpace(raw)
if len(raw) == 0 {
diff --git a/lib/email/maildir/manager.go b/lib/email/maildir/manager.go
index 17f28ecf..aa96cff7 100644
--- a/lib/email/maildir/manager.go
+++ b/lib/email/maildir/manager.go
@@ -193,7 +193,7 @@ func (mg *Manager) Incoming(email []byte) (err error) {
return err
}
- err = ioutil.WriteFile(tmpFile, email, 0660) //nolint: gosec
+ err = ioutil.WriteFile(tmpFile, email, 0660)
if err != nil {
err = fmt.Errorf("email/maildir: Incoming: %s", err.Error())
return err
diff --git a/lib/email/message_test.go b/lib/email/message_test.go
index fcca5556..02720bb4 100644
--- a/lib/email/message_test.go
+++ b/lib/email/message_test.go
@@ -149,7 +149,6 @@ func TestMessageDKIMVerify(t *testing.T) {
}
}
-//nolint:lll
func TestMessageDKIMSign(t *testing.T) {
if privateKey == nil || publicKey == nil {
initKeys(t)
diff --git a/lib/email/param.go b/lib/email/param.go
index b8eeb101..adc085c0 100644
--- a/lib/email/param.go
+++ b/lib/email/param.go
@@ -7,7 +7,6 @@ package email
//
// List of known parameter name in header field's value.
//
-//nolint:gochecknoglobals
var (
// Parameter for Text Media Type, RFC 2046 section 4.1.
ParamNameCharset = []byte("charset")
diff --git a/lib/floats64/floats64_test.go b/lib/floats64/floats64_test.go
index 5595ad6e..1b53d2c5 100644
--- a/lib/floats64/floats64_test.go
+++ b/lib/floats64/floats64_test.go
@@ -12,7 +12,6 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint:gochecknoglobals
var (
d = [][]float64{
{},
@@ -252,7 +251,6 @@ func TestSortByIndex(t *testing.T) {
}
}
-//nolint:gochecknoglobals,dupl
var inSorts = [][]float64{
{9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.0},
{9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0, 0.0},
@@ -273,7 +271,6 @@ var inSorts = [][]float64{
6.2},
}
-//nolint:gochecknoglobals,dupl
var expSorts = [][]float64{
{3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0},
{0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0},
@@ -294,7 +291,6 @@ var expSorts = [][]float64{
7.9},
}
-//nolint:gochecknoglobals,dupl
var expSortsDesc = [][]float64{
{9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.0},
{9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0, 0.0},
diff --git a/lib/git/git.go b/lib/git/git.go
index 7dd86d15..5dbd89c3 100644
--- a/lib/git/git.go
+++ b/lib/git/git.go
@@ -22,7 +22,6 @@ const (
_defBranch = "master"
)
-//nolint:gochecknoglobals
var (
_stdout = os.Stdout
_stderr = os.Stderr
diff --git a/lib/git/git_test.go b/lib/git/git_test.go
index 2fda66df..928fdb0d 100644
--- a/lib/git/git_test.go
+++ b/lib/git/git_test.go
@@ -13,7 +13,6 @@ import (
"github.com/shuLhan/share/lib/test/mock"
)
-//nolint:gochecknoglobals
var (
_testRepoDir string
_testRemoteURL string
diff --git a/lib/http/client.go b/lib/http/client.go
index 661e57a8..7f085ca2 100644
--- a/lib/http/client.go
+++ b/lib/http/client.go
@@ -75,7 +75,7 @@ func NewClient(serverURL string, headers http.Header, insecure bool) (client *Cl
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
TLSClientConfig: &tls.Config{
- InsecureSkipVerify: insecure, //nolint: gosec
+ InsecureSkipVerify: insecure,
},
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
diff --git a/lib/http/http_test.go b/lib/http/http_test.go
index 4ffca6f9..3eb809d9 100644
--- a/lib/http/http_test.go
+++ b/lib/http/http_test.go
@@ -14,7 +14,6 @@ import (
libmemfs "github.com/shuLhan/share/lib/memfs"
)
-//nolint:gochecknoglobals
var (
testServer *Server
client = &http.Client{}
diff --git a/lib/http/response_test.go b/lib/http/response_test.go
index e91a12a3..ffd57388 100644
--- a/lib/http/response_test.go
+++ b/lib/http/response_test.go
@@ -105,7 +105,7 @@ func TestParseResponseHeader(t *testing.T) {
for _, c := range cases {
t.Log(c.desc)
- got, rest, err := ParseResponseHeader(c.raw) //nolint:bodyclose
+ got, rest, err := ParseResponseHeader(c.raw)
if err != nil {
test.Assert(t, "error", c.expErr, err.Error(), true)
continue
diff --git a/lib/http/server_test.go b/lib/http/server_test.go
index 7446274f..a691938f 100644
--- a/lib/http/server_test.go
+++ b/lib/http/server_test.go
@@ -171,7 +171,6 @@ func TestRegisterDelete(t *testing.T) {
}
}
-//nolint:gochecknoglobals
var testEvaluator = func(req *http.Request, reqBody []byte) error {
k := req.Form.Get("k")
@@ -631,7 +630,7 @@ func TestServeHTTPOptions(t *testing.T) {
t.Fatal(err)
}
- res, err := client.Do(req) //nolint:bodyclose
+ res, err := client.Do(req)
if err != nil {
t.Fatal(err)
}
diff --git a/lib/hunspell/hunspell.go b/lib/hunspell/hunspell.go
index b961b574..ff666f70 100644
--- a/lib/hunspell/hunspell.go
+++ b/lib/hunspell/hunspell.go
@@ -100,7 +100,7 @@ const (
//
// List of morphological and other IDs.
//
-//nolint: varcheck,deadcode
+//nolint: deadcode,varcheck
const (
morphKeyPH = "ph"
morphKeyST = "st"
diff --git a/lib/hunspell/options.go b/lib/hunspell/options.go
index 55352fa8..d7c353a7 100644
--- a/lib/hunspell/options.go
+++ b/lib/hunspell/options.go
@@ -17,7 +17,6 @@ import (
libstrings "github.com/shuLhan/share/lib/strings"
)
-//nolint: maligned
type affixOptions struct {
//
// Affix file general options.
@@ -179,7 +178,6 @@ func (opts *affixOptions) open(file string) (err error) {
//
// load affix options from string.
//
-//nolint: gocyclo
func (opts *affixOptions) load(content string) (err error) {
p := parser.New(content, "")
diff --git a/lib/ini/ini.go b/lib/ini/ini.go
index 38138272..89a3757c 100644
--- a/lib/ini/ini.go
+++ b/lib/ini/ini.go
@@ -238,7 +238,6 @@ func (in *Ini) Unmarshal(v interface{}) (err error) {
return nil
}
-//nolint: gocyclo
func (in *Ini) unmarshalToStruct(rtipe reflect.Type, rvalue reflect.Value) {
numField := rtipe.NumField()
if numField == 0 {
diff --git a/lib/ini/ini_test.go b/lib/ini/ini_test.go
index ebb69fce..f492a579 100644
--- a/lib/ini/ini_test.go
+++ b/lib/ini/ini_test.go
@@ -238,7 +238,6 @@ func TestGetDefault(t *testing.T) {
}
}
-//nolint:lll
func TestGetInputIni(t *testing.T) {
inputIni, err := Open(testdataInputIni)
if err != nil {
diff --git a/lib/ints/ints_test.go b/lib/ints/ints_test.go
index aba09913..65ae6fa7 100644
--- a/lib/ints/ints_test.go
+++ b/lib/ints/ints_test.go
@@ -12,7 +12,6 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint:gochecknoglobals
var (
d = [][]int{
{},
@@ -259,7 +258,6 @@ func TestSortByIndex(t *testing.T) {
}
}
-//nolint:gochecknoglobals,dupl
var intsInSorts = [][]int{
{9, 8, 7, 6, 5, 4, 3},
{9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
@@ -280,7 +278,6 @@ var intsInSorts = [][]int{
62},
}
-//nolint:gochecknoglobals,dupl
var intsExpSorts = [][]int{
{3, 4, 5, 6, 7, 8, 9},
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
@@ -301,7 +298,6 @@ var intsExpSorts = [][]int{
79},
}
-//nolint:gochecknoglobals,dupl
var intsExpSortsDesc = [][]int{
{9, 8, 7, 6, 5, 4, 3},
{9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
diff --git a/lib/ints64/ints64_test.go b/lib/ints64/ints64_test.go
index 0cdeea63..ee31f109 100644
--- a/lib/ints64/ints64_test.go
+++ b/lib/ints64/ints64_test.go
@@ -11,7 +11,6 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint:gochecknoglobals
var (
d = [][]int64{
{},
@@ -258,7 +257,6 @@ func TestSortByIndex(t *testing.T) {
}
}
-//nolint:gochecknoglobals,dupl
var ints64InSorts = [][]int64{
{9, 8, 7, 6, 5, 4, 3},
{9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
@@ -279,7 +277,6 @@ var ints64InSorts = [][]int64{
62},
}
-//nolint:gochecknoglobals,dupl
var ints64ExpSorts = [][]int64{
{3, 4, 5, 6, 7, 8, 9},
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
@@ -300,7 +297,6 @@ var ints64ExpSorts = [][]int64{
79},
}
-//nolint:gochecknoglobals,dupl
var ints64ExpSortsDesc = [][]int64{
{9, 8, 7, 6, 5, 4, 3},
{9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
diff --git a/lib/json/json_test.go b/lib/json/json_test.go
index d1779f22..91f4a468 100644
--- a/lib/json/json_test.go
+++ b/lib/json/json_test.go
@@ -29,7 +29,7 @@ func TestEscapeString(t *testing.T) {
//\"☺"`,
exp: `\tthis\\ is\n\t\t\/\/\\\"☺\"`,
}, {
- in: `  `, exp: `\u0002\b\f\u000E\u000F\u0010\u0014\u001E\u001F `, //nolint: stylecheck
+ in: `  `, exp: `\u0002\b\f\u000E\u000F\u0010\u0014\u001E\u001F `,
}}
var got string
@@ -90,7 +90,7 @@ func TestUnescapeString(t *testing.T) {
//\"☺"`,
}, {
in: `\u0002\b\f\u000E\u000F\u0010\u0014\u001E\u001F\u263A `,
- exp: ` ☺ `}, { //nolint: stylecheck
+ exp: ` ☺ `}, {
in: `\uerror`,
expErr: `strconv.ParseUint: parsing "erro": invalid syntax`,
}, {
diff --git a/lib/math/big/big.go b/lib/math/big/big.go
index 991110ea..7f228348 100644
--- a/lib/math/big/big.go
+++ b/lib/math/big/big.go
@@ -19,5 +19,4 @@ package big
// One should change this value before using the new extended Float or Rat in
// the program.
//
-//nolint: gochecknoglobals
var DefaultDigitPrecision = 8
diff --git a/lib/math/big/float.go b/lib/math/big/float.go
index 8dc1e38b..302aaf44 100644
--- a/lib/math/big/float.go
+++ b/lib/math/big/float.go
@@ -19,7 +19,6 @@ import (
// One should change this value before using the new extended Float in the
// program.
//
-//nolint: gochecknoglobals
var DefaultBitPrecision uint = 128
//
@@ -29,7 +28,6 @@ var DefaultBitPrecision uint = 128
// One should change this value before using the new extended Float in the
// program.
//
-//nolint: gochecknoglobals
var DefaultRoundingMode = big.ToNearestAway
//
diff --git a/lib/math/big/rat.go b/lib/math/big/rat.go
index bb2eedbe..1b749a41 100644
--- a/lib/math/big/rat.go
+++ b/lib/math/big/rat.go
@@ -13,7 +13,6 @@ import (
"strings"
)
-//nolint: gochecknoglobals
var ratZero = NewRat(0)
//
diff --git a/lib/memfs/generate_test/memfs_generate_test.go b/lib/memfs/generate_test/memfs_generate_test.go
index 3d1b886a..a5830b23 100644
--- a/lib/memfs/generate_test/memfs_generate_test.go
+++ b/lib/memfs/generate_test/memfs_generate_test.go
@@ -29,7 +29,7 @@ func TestGeneratePathNode(t *testing.T) {
V: []byte("<html></html>\n"),
}
- expExcludeIndexHTML.SetMode(420) //nolint: staticcheck
+ expExcludeIndexHTML.SetMode(0644)
expExcludeIndexHTML.SetName("index.html")
expExcludeIndexHTML.SetSize(14)
diff --git a/lib/memfs/memfs.go b/lib/memfs/memfs.go
index ebfb72d0..d5b05f29 100644
--- a/lib/memfs/memfs.go
+++ b/lib/memfs/memfs.go
@@ -30,7 +30,6 @@ const (
EncodingGzip = "gzip"
)
-//nolint:gochecknoglobals
var (
// MaxFileSize define maximum file size that can be stored on memory.
// The default value is 5 MB.
diff --git a/lib/memfs/memfs_test.go b/lib/memfs/memfs_test.go
index 3bbdf208..efcef1f9 100644
--- a/lib/memfs/memfs_test.go
+++ b/lib/memfs/memfs_test.go
@@ -11,7 +11,6 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint:gochecknoglobals
var (
_testWD string
)
diff --git a/lib/mining/classifier/rf/rf_test.go b/lib/mining/classifier/rf/rf_test.go
index c4dc85de..eab1d7f0 100644
--- a/lib/mining/classifier/rf/rf_test.go
+++ b/lib/mining/classifier/rf/rf_test.go
@@ -18,7 +18,6 @@ import (
//
// Global options to run for each test.
//
-//nolint:gochecknoglobals
var (
// SampleDsvFile is the file that contain samples config.
SampleDsvFile string
diff --git a/lib/mining/dict.go b/lib/mining/dict.go
index 7c90d6b6..487a4a2b 100644
--- a/lib/mining/dict.go
+++ b/lib/mining/dict.go
@@ -8,7 +8,6 @@ package mining
// VulgarWords contain list of vulgar and offensive words in informal and
// slangs.
//
-//nolint:misspell,gochecknoglobals
var VulgarWords = []string{
"$#!+", "$1ut", "$h1t", "$hit", "$lut", "'f*ck'", "'ho", "'hobag",
"@ss", "@sshole", "a$$", "a$$h0!e", "a$$h01e", "a$$h0le", "a$$hole",
@@ -135,7 +134,6 @@ var VulgarWords = []string{
// PronounWords contains list of first and second person pronouns including
// slangs.
//
-//nolint:gochecknoglobals
var PronounWords = []string{
"i", "me", "mine", "my", "myself", "our", "ours", "ourself",
"ourselves", "selves", "thee", "thine", "thou", "thy", "thyself",
@@ -147,7 +145,6 @@ var PronounWords = []string{
//
// BiasedWords contain list of colloquial words with high bias.
//
-//nolint:gochecknoglobals
var BiasedWords = []string{
"cutting-edge", "single-handedly", "well-established", "well-known",
"world-class", "absolute", "acclaimed", "amazing", "astonishing",
@@ -171,7 +168,6 @@ var BiasedWords = []string{
//
// SexWords contain list of non-vulgar sex-related words.
//
-//nolint:gochecknoglobals
var SexWords = []string{
"anal", "breast", "breasts", "buttocks", "dildo", "dildos", "erect",
"nipple", "nipples", "penis", "sex", "sodomized", "sodomy", "vagina",
@@ -181,7 +177,6 @@ var SexWords = []string{
//
// BadWords contain list of colloquial words or bad writing words.
//
-//nolint:gochecknoglobals
var BadWords = []string{
"666", "da", "dont", "dosent", "whatever", "guy", "hi", "nazi", "sup",
"guise", "loser", "thats", "ugly", "wanna", "whats", "wont", "gotta",
diff --git a/lib/mining/gain/gini/gini_test.go b/lib/mining/gain/gini/gini_test.go
index 4237cc7f..c2dd2977 100644
--- a/lib/mining/gain/gini/gini_test.go
+++ b/lib/mining/gain/gini/gini_test.go
@@ -9,7 +9,6 @@ import (
"testing"
)
-//nolint:gochecknoglobals
var (
data = [][]float64{
{1.0, 6.0, 5.0, 4.0, 7.0, 3.0, 8.0, 7.0, 5.0},
diff --git a/lib/mining/knn/neighbor_test.go b/lib/mining/knn/neighbor_test.go
index e7fec993..1e8488c9 100644
--- a/lib/mining/knn/neighbor_test.go
+++ b/lib/mining/knn/neighbor_test.go
@@ -14,7 +14,6 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint:gochecknoglobals
var (
dataFloat64 = [][]float64{
{0.243474, 0.505146, 0.472892, 1.34802, -0.844252, 1},
diff --git a/lib/net/resolvconf.go b/lib/net/resolvconf.go
index 25c1e6e3..da435ad2 100644
--- a/lib/net/resolvconf.go
+++ b/lib/net/resolvconf.go
@@ -17,7 +17,6 @@ const (
envLocaldomain = "LOCALDOMAIN"
)
-//nolint:gochecknoglobals
var (
newLineTerms = []byte{'\n'}
diff --git a/lib/reflect/reflect.go b/lib/reflect/reflect.go
index 1e89c132..8de61b61 100644
--- a/lib/reflect/reflect.go
+++ b/lib/reflect/reflect.go
@@ -40,7 +40,6 @@ func IsEqual(x, y interface{}) bool {
return isEqual(v1, v2)
}
-//nolint: gocyclo
func isEqual(v1, v2 reflect.Value) bool {
if !v1.IsValid() || !v2.IsValid() {
return v1.IsValid() == v2.IsValid()
diff --git a/lib/runes/runes_test.go b/lib/runes/runes_test.go
index ac0d442d..9eeaa966 100644
--- a/lib/runes/runes_test.go
+++ b/lib/runes/runes_test.go
@@ -40,7 +40,6 @@ func TestDiff(t *testing.T) {
}
}
-//nolint:dupl
func TestEncloseRemove(t *testing.T) {
line := []rune(`// Copyright 2016-2018 "Shulhan <ms@kilabit.info>". All rights reserved.`)
diff --git a/lib/smtp/client.go b/lib/smtp/client.go
index 21ad0d69..67b24e2b 100644
--- a/lib/smtp/client.go
+++ b/lib/smtp/client.go
@@ -166,7 +166,7 @@ func (cl *Client) connect(localName string) (res *Response, err error) {
if cl.isTLS {
tlsConfig := &tls.Config{
ServerName: cl.serverName,
- InsecureSkipVerify: cl.insecure, //nolint:gosec
+ InsecureSkipVerify: cl.insecure,
}
cl.conn = tls.Client(cl.conn, tlsConfig)
@@ -467,7 +467,7 @@ func (cl *Client) StartTLS() (res *Response, err error) {
tlsConfig := &tls.Config{
ServerName: cl.serverName,
- InsecureSkipVerify: cl.insecure, //nolint:gosec
+ InsecureSkipVerify: cl.insecure,
}
cl.conn = tls.Client(cl.conn, tlsConfig)
diff --git a/lib/smtp/command.go b/lib/smtp/command.go
index d9c58608..a21363bd 100644
--- a/lib/smtp/command.go
+++ b/lib/smtp/command.go
@@ -142,7 +142,7 @@ func (cmd *Command) reset() {
//
// unpack parse a command type, argument, and their parameters.
//
-func (cmd *Command) unpack(b []byte) (err error) { //nolint:gocyclo,gocognit
+func (cmd *Command) unpack(b []byte) (err error) {
// Minimum command length is 4 + CRLF.
if len(b) < 6 {
return errCmdUnknown
diff --git a/lib/smtp/extension.go b/lib/smtp/extension.go
index 1a902c52..6adcecc0 100644
--- a/lib/smtp/extension.go
+++ b/lib/smtp/extension.go
@@ -25,7 +25,6 @@ type Extension interface {
ValidateCommand(cmd *Command) error
}
-//nolint:gochecknoglobals
var defaultExts = []Extension{
&extDSN{},
}
diff --git a/lib/smtp/mail.go b/lib/smtp/mail.go
index aca86fde..d4bebb65 100644
--- a/lib/smtp/mail.go
+++ b/lib/smtp/mail.go
@@ -92,7 +92,6 @@ func (mail *MailTx) isPostponed() bool {
//
// seal the mail envelope by inserting trace information into message content.
//
-//nolint:gosec
func (mail *MailTx) seal(clientDomain, clientAddress, localAddress string) {
line := fmt.Sprintf("FROM %s (%s)\r\n\tBY %s WITH SMTP ID %s;\r\n\t%s",
clientDomain, clientAddress, localAddress, mail.ID,
diff --git a/lib/smtp/server.go b/lib/smtp/server.go
index 3a8e6df9..5854bf61 100644
--- a/lib/smtp/server.go
+++ b/lib/smtp/server.go
@@ -255,7 +255,6 @@ out:
//
// handleCommand from client.
//
-//nolint:gocyclo
func (srv *Server) handleCommand(recv *receiver, cmd *Command) (err error) {
if debug.Value > 0 {
log.Printf("handleCommand: %v\n", cmd)
diff --git a/lib/smtp/smtp_test.go b/lib/smtp/smtp_test.go
index 1976d902..24f57a0f 100644
--- a/lib/smtp/smtp_test.go
+++ b/lib/smtp/smtp_test.go
@@ -25,7 +25,6 @@ const (
testFilePrivateKey = "testdata/" + testDomain + ".key.pem"
)
-//nolint:gochecknoglobals
var (
testClient *Client
testServer *Server
diff --git a/lib/spf/spf.go b/lib/spf/spf.go
index bd49bd5d..e464d554 100644
--- a/lib/spf/spf.go
+++ b/lib/spf/spf.go
@@ -51,14 +51,12 @@ const (
ResultCodePermError
)
-//nolint:gochecknoglobals
var (
dnsClient *libdns.UDPClient
defSystemResolv = ""
defNameserver = "1.1.1.1"
)
-//nolint:gochecknoinits
func init() {
var err error
diff --git a/lib/sql/table.go b/lib/sql/table.go
index 3dbdb984..4ecb198d 100644
--- a/lib/sql/table.go
+++ b/lib/sql/table.go
@@ -33,7 +33,6 @@ func (table *Table) Insert(tx *sql.Tx) (ids []int64, err error) {
continue
}
- //nolint: gosec
q := fmt.Sprintf("INSERT INTO %s (%s) VALUES (%s)",
table.Name, strings.Join(names, ","),
strings.Join(holders, ","))
diff --git a/lib/ssh/client.go b/lib/ssh/client.go
index 0e360e62..d3ae9af6 100644
--- a/lib/ssh/client.go
+++ b/lib/ssh/client.go
@@ -36,7 +36,7 @@ func NewClient(cfg *ConfigSection) (cl *Client, err error) {
Auth: []ssh.AuthMethod{
ssh.PublicKeys(cfg.signers...),
},
- HostKeyCallback: ssh.InsecureIgnoreHostKey(), //nolint:gosec
+ HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}
cl = &Client{
@@ -101,7 +101,6 @@ func (cl *Client) Get(remote, local string) (err error) {
remote = fmt.Sprintf("%s@%s:%s", cl.cfg.User, cl.cfg.Hostname, remote)
- //nolint: gosec
cmd := exec.Command("scp", "-r", "-i", cl.cfg.privateKeyFile,
"-P", cl.cfg.stringPort, remote, local)
@@ -135,7 +134,6 @@ func (cl *Client) Put(local, remote string) (err error) {
remote = fmt.Sprintf("%s@%s:%s", cl.cfg.User, cl.cfg.Hostname, remote)
- //nolint: gosec
cmd := exec.Command("scp", "-r", "-i", cl.cfg.privateKeyFile,
"-P", cl.cfg.stringPort, local, remote)
diff --git a/lib/ssh/config.go b/lib/ssh/config.go
index 9ea9a1c2..f8b83561 100644
--- a/lib/ssh/config.go
+++ b/lib/ssh/config.go
@@ -46,7 +46,7 @@ const (
)
//TODO: list of keys that are not implemented.
-//nolint:varcheck,deadcode
+//nolint: deadcode,varcheck
const (
keyCiphers = "ciphers"
keyControlMaster = "controlmaster"
@@ -129,7 +129,6 @@ type Config struct {
//
// NewConfig load SSH configuration from file.
//
-//nolint: gocyclo
func NewConfig(file string) (cfg *Config, err error) {
if len(file) == 0 {
return nil, nil
diff --git a/lib/ssh/config_parser_test.go b/lib/ssh/config_parser_test.go
index 27a46741..7e564f6e 100644
--- a/lib/ssh/config_parser_test.go
+++ b/lib/ssh/config_parser_test.go
@@ -18,7 +18,7 @@ func TestIsIncludeDirective(t *testing.T) {
}{{
line: "",
}, {
- line: "includ", //nolint: misspell
+ line: "includ",
}, {
line: "INCLUDE",
}, {
diff --git a/lib/ssh/ssh_test.go b/lib/ssh/ssh_test.go
index 1f84db0b..33ddfe66 100644
--- a/lib/ssh/ssh_test.go
+++ b/lib/ssh/ssh_test.go
@@ -12,7 +12,6 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint: gochecknoglobals
var (
testDefaultSection = newConfigSection()
testParser *configParser
diff --git a/lib/strings/statistic_test.go b/lib/strings/statistic_test.go
index 286c066b..5e498a83 100644
--- a/lib/strings/statistic_test.go
+++ b/lib/strings/statistic_test.go
@@ -61,7 +61,6 @@ func TestCountAlnumDistribution(t *testing.T) {
}
}
-//nolint:lll
func TestCountCharSequence(t *testing.T) {
cases := []struct {
text string
@@ -196,7 +195,6 @@ func TestCountUpperLower(t *testing.T) {
}
}
-//nolint:lll
func TestMaxCharSequence(t *testing.T) {
cases := []struct {
text string
diff --git a/lib/strings/string_test.go b/lib/strings/string_test.go
index d161dfd7..1d404a24 100644
--- a/lib/strings/string_test.go
+++ b/lib/strings/string_test.go
@@ -10,7 +10,6 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint:lll
func TestCleanURI(t *testing.T) {
cases := []struct {
text string
diff --git a/lib/strings/wikimarkup.go b/lib/strings/wikimarkup.go
index 75b24d60..3f0ac08b 100644
--- a/lib/strings/wikimarkup.go
+++ b/lib/strings/wikimarkup.go
@@ -13,7 +13,6 @@ type wikiMarkup struct {
//
// listWikiMarkup contains list of common markup in Wikimedia software.
//
-//nolint:gochecknoglobals
var listWikiMarkup = []wikiMarkup{{
begin: "[[Category:",
end: "]]",
diff --git a/lib/tabula/dataset_test.go b/lib/tabula/dataset_test.go
index 52f9954a..89e70b97 100644
--- a/lib/tabula/dataset_test.go
+++ b/lib/tabula/dataset_test.go
@@ -11,7 +11,6 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint:gochecknoglobals
var (
datasetRows = [][]string{
{"0", "1", "A"},
diff --git a/lib/tabula/tabula_test.go b/lib/tabula/tabula_test.go
index dd8e646c..1d0f8be4 100644
--- a/lib/tabula/tabula_test.go
+++ b/lib/tabula/tabula_test.go
@@ -4,7 +4,6 @@
package tabula
-//nolint:gochecknoglobals
var (
testColTypes = []int{
TInteger,
diff --git a/lib/test/mock/mock.go b/lib/test/mock/mock.go
index 981862fb..aa8810db 100644
--- a/lib/test/mock/mock.go
+++ b/lib/test/mock/mock.go
@@ -12,7 +12,6 @@ import (
"os"
)
-//nolint:gochecknoglobals
var (
_stderr *os.File
_stdin *os.File
diff --git a/lib/text/diff/diff.go b/lib/text/diff/diff.go
index b32ede69..e0599b05 100644
--- a/lib/text/diff/diff.go
+++ b/lib/text/diff/diff.go
@@ -13,7 +13,6 @@ import (
"github.com/shuLhan/share/lib/text"
)
-//nolint:gochecknoglobals
var (
// DefDelimiter define default delimiter for new line.
DefDelimiter = byte('\n')
diff --git a/lib/text/diff/diff_test.go b/lib/text/diff/diff_test.go
index 0d209a06..a652b9dd 100644
--- a/lib/text/diff/diff_test.go
+++ b/lib/text/diff/diff_test.go
@@ -230,7 +230,7 @@ func TestDiffFilesLevelWords(t *testing.T) {
// golint:
compareChunks(t, diffs.Changes[0].Adds, diffs.Changes[0].Dels,
[]string{","},
- []string{"alse "}, //nolint:misspell
+ []string{"alse "},
)
oldrev = "testdata/Psusennes_II.old"
@@ -375,7 +375,6 @@ func TestBytesRatio(t *testing.T) {
}
}
-//nolint:lll
func TestDiffFilesLevelWords3(t *testing.T) {
oldrev := "testdata/the_singles_collection.old"
newrev := "testdata/the_singles_collection.new"
diff --git a/lib/text/diff/diffinterface.go b/lib/text/diff/diffinterface.go
index 40cd2a56..4e61948c 100644
--- a/lib/text/diff/diffinterface.go
+++ b/lib/text/diff/diffinterface.go
@@ -227,7 +227,6 @@ func findLine(line text.Line, text text.Lines, startat int) (
//
// Files compare two files.
//
-//nolint:gocyclo
func Files(oldf, newf string, difflevel int) (diffs Data, e error) {
oldlines, e := ReadLines(oldf)
if e != nil {
diff --git a/lib/time/time.go b/lib/time/time.go
index eff11f70..503f1c5d 100644
--- a/lib/time/time.go
+++ b/lib/time/time.go
@@ -10,7 +10,6 @@ import (
"time"
)
-//nolint:gochecknoglobals
var (
ShortDayNames = []string{
"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
diff --git a/lib/websocket/client.go b/lib/websocket/client.go
index 455a4b78..9aeae12b 100644
--- a/lib/websocket/client.go
+++ b/lib/websocket/client.go
@@ -627,7 +627,7 @@ func (cl *Client) handleHandshake(keyAccept string, resp []byte) (rest []byte, e
var httpRes *http.Response
- httpRes, rest, err = libhttp.ParseResponseHeader(resp) //nolint:bodyclose
+ httpRes, rest, err = libhttp.ParseResponseHeader(resp)
if err != nil {
return nil, err
}
diff --git a/lib/websocket/frame_test.go b/lib/websocket/frame_test.go
index a060e83a..306dd3f9 100644
--- a/lib/websocket/frame_test.go
+++ b/lib/websocket/frame_test.go
@@ -11,7 +11,6 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint:dupl
func TestNewFrameBin(t *testing.T) {
cases := []struct {
desc string
@@ -94,7 +93,6 @@ func TestNewFrameClose(t *testing.T) {
}
}
-//nolint:dupl
func TestNewFramePing(t *testing.T) {
cases := []struct {
desc string
@@ -134,7 +132,6 @@ func TestNewFramePing(t *testing.T) {
}
}
-//nolint:dupl
func TestNewFramePong(t *testing.T) {
cases := []struct {
desc string
@@ -174,7 +171,6 @@ func TestNewFramePong(t *testing.T) {
}
}
-//nolint:dupl
func TestNewFrameText(t *testing.T) {
cases := []struct {
desc string
diff --git a/lib/websocket/funcs.go b/lib/websocket/funcs.go
index f2016eb8..80d6cc18 100644
--- a/lib/websocket/funcs.go
+++ b/lib/websocket/funcs.go
@@ -5,7 +5,7 @@
package websocket
import (
- "crypto/sha1" //nolint:gosec
+ "crypto/sha1"
"encoding/base64"
"encoding/binary"
"log"
@@ -87,7 +87,7 @@ func Send(fd int, packet []byte) (err error) {
//
func generateHandshakeAccept(key []byte) string {
key = append(key, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"...)
- sum := sha1.Sum(key) //nolint:gosec
+ sum := sha1.Sum(key)
return base64.StdEncoding.EncodeToString(sum[:])
}
diff --git a/lib/websocket/handshake.go b/lib/websocket/handshake.go
index b57034c0..e8d6c661 100644
--- a/lib/websocket/handshake.go
+++ b/lib/websocket/handshake.go
@@ -61,7 +61,6 @@ const (
_hdrValWSVersion = "13"
)
-//nolint:gochecknoglobals
var (
_handshakePool = sync.Pool{
New: func() interface{} {
@@ -319,7 +318,6 @@ func (h *Handshake) headerValueContains(hv, sub []byte) bool {
//
// The minimum length of request without HTTP line is: 144 - 16 = 128 bytes.
//
-//nolint:gocyclo
func (h *Handshake) parse(req []byte) (err error) {
if len(req) < 144 {
return ErrRequestLength
diff --git a/lib/websocket/request.go b/lib/websocket/request.go
index 343da267..aae3e44a 100644
--- a/lib/websocket/request.go
+++ b/lib/websocket/request.go
@@ -11,7 +11,6 @@ import (
"sync"
)
-//nolint:gochecknoglobals
var (
_reqPool = sync.Pool{
New: func() interface{} {
diff --git a/lib/websocket/response.go b/lib/websocket/response.go
index e22a9f0a..78c740f1 100644
--- a/lib/websocket/response.go
+++ b/lib/websocket/response.go
@@ -9,7 +9,6 @@ import (
"sync"
)
-//nolint:gochecknoglobals
var (
_resPool = sync.Pool{
New: func() interface{} {
diff --git a/lib/websocket/rootroute_test.go b/lib/websocket/rootroute_test.go
index f09232a7..c9ec3c32 100644
--- a/lib/websocket/rootroute_test.go
+++ b/lib/websocket/rootroute_test.go
@@ -13,14 +13,13 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint:gochecknoglobals
var (
_testRootRoute = newRootRoute()
_testDefMethod string
)
func testRouteHandler(t *testing.T, target string) RouteHandler {
- return func(ctx context.Context, req *Request) (res Response) { //nolint:unparam
+ return func(ctx context.Context, req *Request) (res Response) {
test.Assert(t, "routeHandler", target, req.Target, true)
return
}
diff --git a/lib/websocket/server_bench_test.go b/lib/websocket/server_bench_test.go
index 9d2ae408..ab4189f6 100644
--- a/lib/websocket/server_bench_test.go
+++ b/lib/websocket/server_bench_test.go
@@ -28,7 +28,6 @@ type upgradeCase struct {
req *http.Request
}
-//nolint:gochecknoglobals
var upgradeCases = []upgradeCase{
{
label: "base",
@@ -254,7 +253,7 @@ func withoutHeader(header string, req *http.Request) *http.Request {
func initNonce(dst []byte) {
// NOTE: bts does not escapes.
bts := make([]byte, nonceKeySize)
- if _, err := rand.Read(bts); err != nil { //nolint:gas
+ if _, err := rand.Read(bts); err != nil {
panic(fmt.Sprintf("rand read error: %s", err))
}
base64.StdEncoding.Encode(dst, bts)
diff --git a/lib/websocket/websocket.go b/lib/websocket/websocket.go
index 69833fbd..fba5a4a3 100644
--- a/lib/websocket/websocket.go
+++ b/lib/websocket/websocket.go
@@ -5,7 +5,7 @@
package websocket
import (
- "bytes" //nolint:gosec
+ "bytes"
"math/rand"
"sync"
"time"
@@ -24,7 +24,6 @@ const (
frameIsMasked = 0x80
)
-//nolint:gochecknoglobals
var (
defaultTimeout = 10 * time.Second
defaultPingInterval = 10 * time.Second
@@ -36,7 +35,6 @@ var (
}
)
-//nolint:gochecknoinits
func init() {
rand.Seed(time.Now().UnixNano())
}
diff --git a/lib/websocket/websocket_test.go b/lib/websocket/websocket_test.go
index edc02470..33ee727c 100644
--- a/lib/websocket/websocket_test.go
+++ b/lib/websocket/websocket_test.go
@@ -15,7 +15,6 @@ import (
"time"
)
-//nolint:lll,gochecknoglobals
var (
_testExternalJWT = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MzA0NjU2MDYsImhhc2giOiJiYmJiYmJiYi1iYmJiLWJiYmItYmJiYi1iYmJiYmJiYmJiYmIiLCJpYXQiOjE1MzAyMDY0MDYsIm5hZiI6MTUzMjc5ODQwNn0.15quj_gkeo9cWkLN98_2rXjtjihQym16Kn_9BQjYC14"
diff --git a/lib/xmlrpc/client.go b/lib/xmlrpc/client.go
index fb37f6d5..163c4e87 100644
--- a/lib/xmlrpc/client.go
+++ b/lib/xmlrpc/client.go
@@ -69,7 +69,7 @@ func NewClient(url *url.URL, timeout time.Duration) (client *Client, err error)
config := &tls.Config{
ServerName: host,
- InsecureSkipVerify: insecure, //nolint: gosec
+ InsecureSkipVerify: insecure,
}
client.conn, err = tls.Dial("tcp", host, config)
@@ -98,7 +98,7 @@ func (cl *Client) Close() (err error) {
//
// Send the RPC method with parameters to the server.
//
-func (cl *Client) Send(req Request) (resp Response, err error) { //nolint: interfacer
+func (cl *Client) Send(req Request) (resp Response, err error) {
var buf bytes.Buffer
xmlbin, _ := req.MarshalText()