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,16 +4,29 @@ run:
|
|||||||
silent: true
|
silent: true
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
|
errcheck:
|
||||||
|
check-blank: true
|
||||||
|
gocognit:
|
||||||
|
min-complexity: 50
|
||||||
|
gocritic:
|
||||||
|
enabled-tags:
|
||||||
|
- diagnostic
|
||||||
|
- performance
|
||||||
|
- style
|
||||||
lll:
|
lll:
|
||||||
line-length: 180
|
line-length: 180
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
enable-all: true
|
enable-all: true
|
||||||
disable:
|
disable:
|
||||||
|
- funlen
|
||||||
- gas
|
- gas
|
||||||
|
- gochecknoglobals
|
||||||
- interfacer
|
- interfacer
|
||||||
- maligned
|
- maligned
|
||||||
- nakedret
|
- nakedret
|
||||||
|
- stylecheck
|
||||||
|
- wsl
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
exclude-use-default: false
|
exclude-use-default: false
|
||||||
|
|||||||
6
Makefile
6
Makefile
@@ -4,10 +4,6 @@ ifndef GOBIN
|
|||||||
export GOBIN := $(GOPATH)/bin
|
export GOBIN := $(GOPATH)/bin
|
||||||
endif
|
endif
|
||||||
|
|
||||||
define dl
|
|
||||||
@curl -sSq -L $(2) -o $(GOBIN)/$(1) && chmod u+x $(GOBIN)/$(1)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define dl_tgz
|
define dl_tgz
|
||||||
@curl -sSq -L $(2) | tar zxf - --strip 1 -C $(GOBIN) --wildcards '*/$(1)'
|
@curl -sSq -L $(2) | tar zxf - --strip 1 -C $(GOBIN) --wildcards '*/$(1)'
|
||||||
endef
|
endef
|
||||||
@@ -40,4 +36,4 @@ get-deps:
|
|||||||
.PHONY: get-tools
|
.PHONY: get-tools
|
||||||
get-tools:
|
get-tools:
|
||||||
@echo "==> Installing tools at $(GOBIN)..."
|
@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 (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -24,16 +23,8 @@ var (
|
|||||||
flagRetry = flag.Int("retries", 5, "number of times to retry queries")
|
flagRetry = flag.Int("retries", 5, "number of times to retry queries")
|
||||||
flagCompressTest = flag.String("compressor", "", "compressor to use")
|
flagCompressTest = flag.String("compressor", "", "compressor to use")
|
||||||
flagTimeout = flag.Duration("gocql.timeout", 5*time.Second, "sets the connection `timeout` for all operations")
|
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
|
var initOnce sync.Once
|
||||||
|
|
||||||
// CreateSession creates a new gocql session from flags.
|
// CreateSession creates a new gocql session from flags.
|
||||||
@@ -43,6 +34,11 @@ func CreateSession(tb testing.TB) *gocql.Session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createCluster() *gocql.ClusterConfig {
|
func createCluster() *gocql.ClusterConfig {
|
||||||
|
if !flag.Parsed() {
|
||||||
|
flag.Parse()
|
||||||
|
}
|
||||||
|
clusterHosts := strings.Split(*flagCluster, ",")
|
||||||
|
|
||||||
cluster := gocql.NewCluster(clusterHosts...)
|
cluster := gocql.NewCluster(clusterHosts...)
|
||||||
cluster.ProtoVersion = *flagProto
|
cluster.ProtoVersion = *flagProto
|
||||||
cluster.CQLVersion = *flagCQL
|
cluster.CQLVersion = *flagCQL
|
||||||
|
|||||||
@@ -30,5 +30,5 @@ func fileChecksum(path string) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
v := h.Sum(nil)
|
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
|
// AddStmtWithPrefix adds statement to the batch. Names are prefixed with
|
||||||
// the prefix + ".".
|
// 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)
|
b.stmts = append(b.stmts, stmt)
|
||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
if prefix != "" {
|
if prefix != "" {
|
||||||
|
|||||||
@@ -230,7 +230,6 @@ func (b *SelectBuilder) Sum(column string) *SelectBuilder {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *SelectBuilder) fn(name, column string) *SelectBuilder {
|
func (b *SelectBuilder) fn(name, column string) {
|
||||||
b.Columns(name + "(" + column + ")")
|
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 {
|
for i, b := range qs {
|
||||||
// a ':' while we're in a name is an error
|
// 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 this is the second ':' in a '::' escape sequence, append a ':'
|
||||||
if inName && i > 0 && qs[i-1] == ':' {
|
if inName && i > 0 && qs[i-1] == ':' {
|
||||||
rebound = append(rebound, ':')
|
rebound = append(rebound, ':')
|
||||||
@@ -46,11 +47,11 @@ func CompileNamedQuery(qs []byte) (stmt string, names []string, err error) {
|
|||||||
inName = true
|
inName = true
|
||||||
name = []byte{}
|
name = []byte{}
|
||||||
// if we're in a name, and this is an allowed character, continue
|
// 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
|
// append the byte to the name if we are in a name and not on the last byte
|
||||||
name = append(name, b)
|
name = append(name, b)
|
||||||
// if we're in a name and it's not an allowed character, the name is done
|
// if we're in a name and it's not an allowed character, the name is done
|
||||||
} else if inName {
|
case inName:
|
||||||
inName = false
|
inName = false
|
||||||
// if this is the final byte of the string and it is part of the name, then
|
// 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
|
// 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) {
|
} else if !allowedBindRune(b) {
|
||||||
rebound = append(rebound, b)
|
rebound = append(rebound, b)
|
||||||
}
|
}
|
||||||
} else {
|
default:
|
||||||
// this is a normal byte and should just go onto the rebound query
|
// this is a normal byte and should just go onto the rebound query
|
||||||
rebound = append(rebound, b)
|
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 {
|
err := m.TraversalsByNameFunc(v.Type(), names, func(i int, t []int) error {
|
||||||
if len(t) != 0 {
|
if len(t) != 0 {
|
||||||
val := reflectx.FieldByIndexesReadOnly(v, t)
|
val := reflectx.FieldByIndexesReadOnly(v, t) // nolint:scopelint
|
||||||
arglist = append(arglist, val.Interface())
|
arglist = append(arglist, val.Interface())
|
||||||
} else {
|
} else {
|
||||||
val, ok := arg1[names[i]]
|
val, ok := arg1[names[i]]
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ type Table struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// New creates new Table based on table schema read from Metadata.
|
// 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{
|
t := &Table{
|
||||||
metadata: m,
|
metadata: m,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user