Updated golandci-lint to 1.21.0
Signed-off-by: Michał Matczuk <michal@scylladb.com>
This commit is contained in:
committed by
Michal Matczuk
parent
3e60935d2a
commit
1668ca5832
@@ -4,20 +4,33 @@ run:
|
||||
silent: true
|
||||
|
||||
linters-settings:
|
||||
errcheck:
|
||||
check-blank: true
|
||||
gocognit:
|
||||
min-complexity: 50
|
||||
gocritic:
|
||||
enabled-tags:
|
||||
- diagnostic
|
||||
- performance
|
||||
- style
|
||||
lll:
|
||||
line-length: 180
|
||||
|
||||
linters:
|
||||
enable-all: true
|
||||
disable:
|
||||
- gas
|
||||
- interfacer
|
||||
- maligned
|
||||
- nakedret
|
||||
- funlen
|
||||
- gas
|
||||
- gochecknoglobals
|
||||
- interfacer
|
||||
- maligned
|
||||
- nakedret
|
||||
- stylecheck
|
||||
- wsl
|
||||
|
||||
issues:
|
||||
exclude-use-default: false
|
||||
exclude:
|
||||
- composite literal uses unkeyed fields
|
||||
- Error return value of `.+\.Close` is not checked
|
||||
- method Json should be JSON
|
||||
- composite literal uses unkeyed fields
|
||||
- Error return value of `.+\.Close` is not checked
|
||||
- method Json should be JSON
|
||||
|
||||
6
Makefile
6
Makefile
@@ -4,10 +4,6 @@ ifndef GOBIN
|
||||
export GOBIN := $(GOPATH)/bin
|
||||
endif
|
||||
|
||||
define dl
|
||||
@curl -sSq -L $(2) -o $(GOBIN)/$(1) && chmod u+x $(GOBIN)/$(1)
|
||||
endef
|
||||
|
||||
define dl_tgz
|
||||
@curl -sSq -L $(2) | tar zxf - --strip 1 -C $(GOBIN) --wildcards '*/$(1)'
|
||||
endef
|
||||
@@ -40,4 +36,4 @@ get-deps:
|
||||
.PHONY: get-tools
|
||||
get-tools:
|
||||
@echo "==> Installing tools at $(GOBIN)..."
|
||||
@$(call dl_tgz,golangci-lint,https://github.com/golangci/golangci-lint/releases/download/v1.10.2/golangci-lint-1.10.2-linux-amd64.tar.gz)
|
||||
@$(call dl_tgz,golangci-lint,https://github.com/golangci/golangci-lint/releases/download/v1.21.0/golangci-lint-1.21.0-linux-amd64.tar.gz)
|
||||
|
||||
@@ -7,7 +7,6 @@ package gocqlxtest
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
@@ -24,16 +23,8 @@ var (
|
||||
flagRetry = flag.Int("retries", 5, "number of times to retry queries")
|
||||
flagCompressTest = flag.String("compressor", "", "compressor to use")
|
||||
flagTimeout = flag.Duration("gocql.timeout", 5*time.Second, "sets the connection `timeout` for all operations")
|
||||
|
||||
clusterHosts []string
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.Parse()
|
||||
clusterHosts = strings.Split(*flagCluster, ",")
|
||||
log.SetFlags(log.Lshortfile | log.LstdFlags)
|
||||
}
|
||||
|
||||
var initOnce sync.Once
|
||||
|
||||
// CreateSession creates a new gocql session from flags.
|
||||
@@ -43,6 +34,11 @@ func CreateSession(tb testing.TB) *gocql.Session {
|
||||
}
|
||||
|
||||
func createCluster() *gocql.ClusterConfig {
|
||||
if !flag.Parsed() {
|
||||
flag.Parse()
|
||||
}
|
||||
clusterHosts := strings.Split(*flagCluster, ",")
|
||||
|
||||
cluster := gocql.NewCluster(clusterHosts...)
|
||||
cluster.ProtoVersion = *flagProto
|
||||
cluster.CQLVersion = *flagCQL
|
||||
|
||||
@@ -30,5 +30,5 @@ func fileChecksum(path string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
v := h.Sum(nil)
|
||||
return encode(v[:]), nil
|
||||
return encode(v), nil
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ func (b *BatchBuilder) AddWithPrefix(prefix string, builder Builder) *BatchBuild
|
||||
|
||||
// AddStmtWithPrefix adds statement to the batch. Names are prefixed with
|
||||
// the prefix + ".".
|
||||
func (b *BatchBuilder) AddStmtWithPrefix(prefix string, stmt string, names []string) *BatchBuilder {
|
||||
func (b *BatchBuilder) AddStmtWithPrefix(prefix, stmt string, names []string) *BatchBuilder {
|
||||
b.stmts = append(b.stmts, stmt)
|
||||
for _, name := range names {
|
||||
if prefix != "" {
|
||||
|
||||
@@ -230,7 +230,6 @@ func (b *SelectBuilder) Sum(column string) *SelectBuilder {
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *SelectBuilder) fn(name, column string) *SelectBuilder {
|
||||
func (b *SelectBuilder) fn(name, column string) {
|
||||
b.Columns(name + "(" + column + ")")
|
||||
return b
|
||||
}
|
||||
|
||||
11
queryx.go
11
queryx.go
@@ -33,7 +33,8 @@ func CompileNamedQuery(qs []byte) (stmt string, names []string, err error) {
|
||||
|
||||
for i, b := range qs {
|
||||
// a ':' while we're in a name is an error
|
||||
if b == ':' {
|
||||
switch {
|
||||
case b == ':':
|
||||
// if this is the second ':' in a '::' escape sequence, append a ':'
|
||||
if inName && i > 0 && qs[i-1] == ':' {
|
||||
rebound = append(rebound, ':')
|
||||
@@ -46,11 +47,11 @@ func CompileNamedQuery(qs []byte) (stmt string, names []string, err error) {
|
||||
inName = true
|
||||
name = []byte{}
|
||||
// if we're in a name, and this is an allowed character, continue
|
||||
} else if inName && (allowedBindRune(b) || b == '_' || b == '.') && i != last {
|
||||
case inName && (allowedBindRune(b) || b == '_' || b == '.') && i != last:
|
||||
// append the byte to the name if we are in a name and not on the last byte
|
||||
name = append(name, b)
|
||||
// if we're in a name and it's not an allowed character, the name is done
|
||||
} else if inName {
|
||||
case inName:
|
||||
inName = false
|
||||
// if this is the final byte of the string and it is part of the name, then
|
||||
// make sure to add it to the name
|
||||
@@ -67,7 +68,7 @@ func CompileNamedQuery(qs []byte) (stmt string, names []string, err error) {
|
||||
} else if !allowedBindRune(b) {
|
||||
rebound = append(rebound, b)
|
||||
}
|
||||
} else {
|
||||
default:
|
||||
// this is a normal byte and should just go onto the rebound query
|
||||
rebound = append(rebound, b)
|
||||
}
|
||||
@@ -137,7 +138,7 @@ func bindStructArgs(names []string, arg0 interface{}, arg1 map[string]interface{
|
||||
|
||||
err := m.TraversalsByNameFunc(v.Type(), names, func(i int, t []int) error {
|
||||
if len(t) != 0 {
|
||||
val := reflectx.FieldByIndexesReadOnly(v, t)
|
||||
val := reflectx.FieldByIndexesReadOnly(v, t) // nolint:scopelint
|
||||
arglist = append(arglist, val.Interface())
|
||||
} else {
|
||||
val, ok := arg1[names[i]]
|
||||
|
||||
@@ -32,7 +32,7 @@ type Table struct {
|
||||
}
|
||||
|
||||
// New creates new Table based on table schema read from Metadata.
|
||||
func New(m Metadata) *Table {
|
||||
func New(m Metadata) *Table { // nolint: gocritic
|
||||
t := &Table{
|
||||
metadata: m,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user