Skip to content

Commit

Permalink
Bump go lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed Aug 14, 2024
1 parent ca6ed61 commit 6a47e53
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 23 deletions.
4 changes: 3 additions & 1 deletion .dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ dependencies:
match: "go "
- path: .github/workflows/golangci-lint.yaml
match: "GO_VERSION: "
- path: .golangci.yaml
match: "go: "
- path: .github/workflows/releases.yaml
match: "GO_VERSION: "
- path: .github/workflows/test.yaml
Expand All @@ -21,7 +23,7 @@ dependencies:
match: "GO_VERSION="

- name: "golangci"
version: 1.58.2
version: 1.60.1
refPaths:
- path: .github/workflows/golangci-lint.yaml
match: "GOLANGCI_VERSION: "
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
GO_VERSION: "1.23.0"
GOLANGCI_VERSION: "1.58.2"
GOLANGCI_VERSION: "1.60.1"

jobs:
golangci:
Expand Down
9 changes: 2 additions & 7 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ linters-settings:
alias: metav1
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: apierrors
staticcheck:
run:
go: "1.22"
stylecheck:
run:
go: "1.22"
# STxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
checks: ["all", "-ST1000", "-ST1003"]
depguard:
Expand Down Expand Up @@ -197,5 +192,5 @@ run:
concurrency: 1
timeout: 10m
allow-parallel-runners: false
skip-dirs-use-default: true
go: "1.22"
allow-serial-runners: true
go: "1.23.0"
2 changes: 1 addition & 1 deletion hack/update-go-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ DIR="$(dirname "${BASH_SOURCE[0]}")"

ROOT_DIR="$(realpath "${DIR}/..")"

COMMAND=(go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.58.2)
COMMAND=(go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.1)

cd "${ROOT_DIR}" && "${COMMAND[@]}" run -c "${ROOT_DIR}/.golangci.yaml" --fix
4 changes: 3 additions & 1 deletion hack/verify-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ if [[ "${VERIFY_GO_FORMAT:-true}" == "true" ]]; then
"${ROOT_DIR}"/hack/verify-go-format.sh || failed+=(go-format)
fi

if [[ "${VERIFY_GO_LINT:-true}" == "true" ]]; then
# TODO: Switch on after a while
# https://github.com/golangci/golangci-lint/issues/4909
if [[ "${VERIFY_GO_LINT:-false}" == "true" ]]; then
echo "[*] Verifying go lint..."
"${ROOT_DIR}"/hack/verify-go-lint.sh || failed+=(go-lint)
fi
Expand Down
2 changes: 1 addition & 1 deletion hack/verify-go-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ DIR="$(dirname "${BASH_SOURCE[0]}")"

ROOT_DIR="$(realpath "${DIR}/..")"

COMMAND=(go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.58.2)
COMMAND=(go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.1)

cd "${ROOT_DIR}" && "${COMMAND[@]}" run -c "${ROOT_DIR}/.golangci.yaml"
2 changes: 1 addition & 1 deletion pkg/kwok/server/debugging_logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ func Test_readLogs(t *testing.T) {
err = readLogs(ctx, file.Name(), opts, stdoutBuf, stderrBuf)

if err != nil && !errors.Is(err, errContextCanceled) {
t.Fatalf(err.Error())
t.Fatal(err)
}
if stderrBuf.Len() > 0 {
t.Fatalf("Stderr: %v", stderrBuf.String())
Expand Down
2 changes: 1 addition & 1 deletion pkg/kwokctl/cmd/hack/del/del.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func runE(ctx context.Context, flags *flagpole, args []string) error {
if flags.Output == "key" {
response = func(kv *etcd.KeyValue) error {
count++
fmt.Fprintf(os.Stdout, "%s\n", kv.Key)
_, _ = fmt.Fprintf(os.Stdout, "%s\n", kv.Key)
return nil
}
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/kwokctl/cmd/hack/get/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ func runE(ctx context.Context, flags *flagpole, args []string) error {
}
inMediaType, err := etcd.DetectMediaType(value)
if err != nil {
fmt.Fprintf(os.Stdout, "---\n# %s | raw | %v\n# %s\n", kv.Key, err, value)
_, _ = fmt.Fprintf(os.Stdout, "---\n# %s | raw | %v\n# %s\n", kv.Key, err, value)
return nil
}
_, data, err := etcd.Convert(inMediaType, outMediaType, value)
if err != nil {
fmt.Fprintf(os.Stdout, "---\n# %s | raw | %v\n# %s\n", kv.Key, err, value)
_, _ = fmt.Fprintf(os.Stdout, "---\n# %s | raw | %v\n# %s\n", kv.Key, err, value)
} else {
fmt.Fprintf(os.Stdout, "---\n# %s | %s\n%s\n", kv.Key, inMediaType, data)
_, _ = fmt.Fprintf(os.Stdout, "---\n# %s | %s\n%s\n", kv.Key, inMediaType, data)
}
return nil
}
Expand All @@ -193,27 +193,27 @@ func runE(ctx context.Context, flags *flagpole, args []string) error {
}
inMediaType, err := etcd.DetectMediaType(value)
if err != nil {
fmt.Fprintf(os.Stdout, "---\n# %s | raw | %v\n# %s\n", kv.Key, err, value)
_, _ = fmt.Fprintf(os.Stdout, "---\n# %s | raw | %v\n# %s\n", kv.Key, err, value)
return nil
}
_, data, err := etcd.Convert(inMediaType, outMediaType, value)
if err != nil {
fmt.Fprintf(os.Stdout, "---\n# %s | raw | %v\n# %s\n", kv.Key, err, value)
_, _ = fmt.Fprintf(os.Stdout, "---\n# %s | raw | %v\n# %s\n", kv.Key, err, value)
} else {
fmt.Fprintf(os.Stdout, "---\n# %s | %s\n%s\n", kv.Key, inMediaType, data)
_, _ = fmt.Fprintf(os.Stdout, "---\n# %s | %s\n%s\n", kv.Key, inMediaType, data)
}
return nil
}
case "raw":
response = func(kv *etcd.KeyValue) error {
count++
fmt.Fprintf(os.Stdout, "%s\n%s\n", kv.Key, kv.Value)
_, _ = fmt.Fprintf(os.Stdout, "%s\n%s\n", kv.Key, kv.Value)
return nil
}
case "key":
response = func(kv *etcd.KeyValue) error {
count++
fmt.Fprintf(os.Stdout, "%s\n", kv.Key)
_, _ = fmt.Fprintf(os.Stdout, "%s\n", kv.Key)
return nil
}
default:
Expand Down
2 changes: 1 addition & 1 deletion pkg/kwokctl/cmd/hack/put/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func runE(ctx context.Context, flags *flagpole, args []string) error {
response = func(kv *etcd.KeyValue) error {
count++
if kv != nil {
fmt.Fprintf(os.Stdout, "%s\n", kv.Key)
_, _ = fmt.Fprintf(os.Stdout, "%s\n", kv.Key)
}
return nil
}
Expand Down

0 comments on commit 6a47e53

Please sign in to comment.