Skip to content

Commit

Permalink
*: Fix linter after Go 1.18 upgrade (#4945)
Browse files Browse the repository at this point in the history
close #4944, ref #4944

Signed-off-by: nolouch <[email protected]>
  • Loading branch information
nolouch authored May 13, 2022
1 parent cbd7145 commit dd8d0b0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18
- name: Checkout code
uses: actions/checkout@v2
- name: Restore cache
Expand All @@ -18,7 +18,6 @@ jobs:
path: |
~/go/pkg/mod
~/.cache/go-build
**/.tools
**/.dashboard_download_cache
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ SHELL := env PATH='$(PATH)' GOBIN='$(GO_TOOLS_BIN_PATH)' $(shell which bash)

install-tools:
@mkdir -p $(GO_TOOLS_BIN_PATH)
@which golangci-lint >/dev/null 2>&1 || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_TOOLS_BIN_PATH) v1.43.0
@which golangci-lint >/dev/null 2>&1 || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_TOOLS_BIN_PATH) v1.46.0
@grep '_' tools.go | sed 's/"//g' | awk '{print $$2}' | xargs go install

.PHONY: install-tools
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ require (
go.etcd.io/etcd v0.5.0-alpha.5.0.20191023171146-3cf2f69b5738
go.uber.org/goleak v1.1.12
go.uber.org/zap v1.19.1
golang.org/x/text v0.3.3
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65
golang.org/x/tools v0.1.5
google.golang.org/grpc v1.26.0
Expand Down
2 changes: 1 addition & 1 deletion pkg/autoscaling/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (prom *PrometheusQuerier) queryMetricsFromPrometheus(query string, timestam
return nil, errs.ErrPrometheusQuery.Wrap(err).FastGenWithCause()
}

if warnings != nil && len(warnings) > 0 {
if len(warnings) > 0 {
log.Warn("prometheus query returns with warnings", zap.Strings("warnings", warnings))
}

Expand Down
3 changes: 2 additions & 1 deletion tests/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,8 @@ func (s *testConfigTTLSuite) TestConfigTTLAfterTransferLeader(c *C) {
addr := fmt.Sprintf("%s/pd/api/v1/config?ttlSecond=5", leader.GetAddr())
postData, err := json.Marshal(ttlConfig)
c.Assert(err, IsNil)
_, err = leader.GetHTTPClient().Post(addr, "application/json", bytes.NewBuffer(postData))
resp, err := leader.GetHTTPClient().Post(addr, "application/json", bytes.NewBuffer(postData))
resp.Body.Close()
c.Assert(err, IsNil)
time.Sleep(2 * time.Second)
_ = leader.Destroy()
Expand Down
5 changes: 4 additions & 1 deletion tools/pd-ctl/pdctl/command/store_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/spf13/cobra"
"github.com/tikv/pd/server/api"
"golang.org/x/text/cases"
"golang.org/x/text/language"
)

var (
Expand Down Expand Up @@ -603,7 +605,8 @@ func storeCheckCommandFunc(cmd *cobra.Command, args []string) {
return
}

state := strings.Title(strings.ToLower(args[0]))
caser := cases.Title(language.Und)
state := caser.String(strings.ToLower(args[0]))
stateValue, ok := metapb.StoreState_value[state]
if !ok {
cmd.Println("Unknown state: " + state)
Expand Down

0 comments on commit dd8d0b0

Please sign in to comment.