Skip to content

chore(ci): golang-lint v2.0.1 #2852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 29 additions & 9 deletions tests/gocase/.golangci.yml
Original file line number Diff line number Diff line change
@@ -14,29 +14,49 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

version: "2"
run:
timeout: 10m
concurrency: 4
allow-parallel-runners: true
allow-serial-runners: true
linters:
disable-all: true
default: none
enable:
- asciicheck
- bodyclose
- copyloopvar
- durationcheck
- errcheck
- copyloopvar
- gofmt
- goimports
- gosimple
- ineffassign
- makezero
- prealloc
- predeclared
- rowserrcheck
- staticcheck
- stylecheck
- typecheck
- unused
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
linters-settings:
staticcheck:
checks:
- all
- '-QF1012' # disable the rule QF1012: Use fmt.Fprintf(...) instead of WriteString(fmt.Sprintf(...))
4 changes: 2 additions & 2 deletions tests/gocase/unit/type/bitmap/bitmap_test.go
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ const (
func Set2SetBit(t *testing.T, rdb *redis.Client, ctx context.Context, key string, bs []byte) {
buf := bytes.NewBuffer([]byte{})
for _, v := range bs {
buf.WriteString(fmt.Sprintf("%08b", v))
_, _ = fmt.Fprintf(buf, "%08b", v)
}
for index, value := range buf.String() {
require.NoError(t, rdb.SetBit(ctx, key, int64(index), int(value)-int('0')).Err())
@@ -74,7 +74,7 @@ func SimulateBitOp(op BITOP, values ...[]byte) string {
for _, value := range values {
buf := bytes.NewBuffer([]byte{})
for _, v := range value {
buf.WriteString(fmt.Sprintf("%08b", v))
_, _ = fmt.Fprintf(buf, "%08b", v)
}
tmp := buf.String() + strings.Repeat("0", maxlen-len(buf.String()))
binaryArray = append(binaryArray, tmp)
13 changes: 8 additions & 5 deletions tests/gocase/unit/type/zset/zset_test.go
Original file line number Diff line number Diff line change
@@ -1661,13 +1661,16 @@ func basicTests(t *testing.T, rdb *redis.Client, ctx context.Context, enabledRES

func stressTests(t *testing.T, rdb *redis.Client, ctx context.Context, encoding string) {
var elements int
if encoding == "ziplist" {
switch encoding {
case "ziplist":
elements = 128
} else if encoding == "skiplist" {
case "skiplist":
elements = 100
} else {
fmt.Println("Unknown sorted set encoding")
return
default:
{
fmt.Println("Unknown sorted set encoding")
return
}
}
t.Run(fmt.Sprintf("ZSCORE - %s", encoding), func(t *testing.T) {
rdb.Del(ctx, "zscoretest")
2 changes: 1 addition & 1 deletion tests/gocase/util/server.go
Original file line number Diff line number Diff line change
@@ -244,7 +244,7 @@ func StartServerWithCLIOptions(
defer func() { require.NoError(t, f.Close()) }()

for k := range configs {
_, err := f.WriteString(fmt.Sprintf("%s %s\n", k, configs[k]))
_, err := fmt.Fprintf(f, "%s %s\n", k, configs[k])
require.NoError(t, err)
}
cmd.Args = append(cmd.Args, "-c", f.Name())
2 changes: 1 addition & 1 deletion x.py
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@
CMAKE_REQUIRE_VERSION = (3, 16, 0)
CLANG_FORMAT_REQUIRED_VERSION = (12, 0, 0)
CLANG_TIDY_REQUIRED_VERSION = (12, 0, 0)
GOLANGCI_LINT_REQUIRED_VERSION = (1, 64, 3)
GOLANGCI_LINT_REQUIRED_VERSION = (2, 2, 2)

SEMVER_REGEX = re.compile(
r"""