Skip to content

Commit

Permalink
*: upgrade go from 1.19 to 1.20 (#6032)
Browse files Browse the repository at this point in the history
close #6029

*: upgrade go from 1.19 to 1.20

Signed-off-by: nolouch <[email protected]>

Co-authored-by: Purelind <[email protected]>
  • Loading branch information
nolouch and purelind authored Feb 23, 2023
1 parent 94d05f0 commit 0469be5
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.1
- name: Checkout code
uses: actions/checkout@v3
- name: Restore cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pd-docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.1
- name: Checkout code
uses: actions/checkout@v3
- name: Make
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pd-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.19"
go-version: "1.20.1"
- name: Checkout code
uses: actions/checkout@v3
- name: Restore cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tso-consistency-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.19"
go-version: "1.20.1"
- name: Checkout code
uses: actions/checkout@v3
- name: Make TSO Consistency Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tso-function-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.19"
go-version: "1.20.1"
- name: Checkout code
uses: actions/checkout@v3
- name: Make TSO Function Test
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-alpine as builder
FROM golang:1.20-alpine as builder

RUN apk add --no-cache \
make \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,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.48.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.51.2
@grep '_' tools.go | sed 's/"//g' | awk '{print $$2}' | xargs go install

.PHONY: install-tools
Expand Down
2 changes: 1 addition & 1 deletion client/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tikv/pd/client

go 1.19
go 1.20

require (
github.com/gogo/protobuf v1.3.2
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tikv/pd

go 1.19
go 1.20

require (
github.com/AlekSi/gocov-xml v1.0.0
Expand Down
2 changes: 1 addition & 1 deletion pkg/core/region_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
package core

import (
"crypto/rand"
"fmt"
"math"
"math/rand"
"strconv"
"testing"

Expand Down
2 changes: 1 addition & 1 deletion pkg/core/region_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,5 +345,5 @@ func (t *regionTree) TotalWriteRate() (bytesRate, keysRate float64) {
}

func init() {
rand.Seed(time.Now().UnixNano())
rand.New(rand.NewSource(time.Now().UnixNano()))
}
2 changes: 1 addition & 1 deletion pkg/movingaverage/moving_average_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

func addRandData(ma MovingAvg, n int, mx float64) {
rand.Seed(time.Now().UnixNano())
rand.New(rand.NewSource(time.Now().UnixNano()))
for i := 0; i < n; i++ {
ma.Add(rand.Float64() * mx)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/endpoint/key_path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestRegionPath(t *testing.T) {
f := func(id uint64) string {
return path.Join(regionPathPrefix, fmt.Sprintf("%020d", id))
}
rand.Seed(time.Now().Unix())
rand.New(rand.NewSource(time.Now().Unix()))
for i := 0; i < 1000; i++ {
id := rand.Uint64()
re.Equal(f(id), RegionPath(id))
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func generateKeys(size int) []string {
}

func randomMerge(regions []*metapb.Region, n int, ratio int) {
rand.Seed(6)
rand.New(rand.NewSource(6))
note := make(map[int]bool)
for i := 0; i < n*ratio/100; i++ {
pos := rand.Intn(n - 1)
Expand Down
2 changes: 1 addition & 1 deletion server/schedule/waiting_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,5 @@ func NewWaitingOperatorStatus() *WaitingOperatorStatus {
}

func init() {
rand.Seed(time.Now().UnixNano())
rand.New(rand.NewSource(time.Now().UnixNano()))
}
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ type HandlerBuilder func(context.Context, *Server) (http.Handler, apiutil.APISer
// CreateServer creates the UNINITIALIZED pd server with given configuration.
func CreateServer(ctx context.Context, cfg *config.Config, legacyServiceBuilders ...HandlerBuilder) (*Server, error) {
log.Info("PD Config", zap.Reflect("config", cfg))
rand.Seed(time.Now().UnixNano())
rand.New(rand.NewSource(time.Now().UnixNano()))
serviceMiddlewareCfg := config.NewServiceMiddlewareConfig()

s := &Server{
Expand Down
2 changes: 1 addition & 1 deletion tests/client/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tikv/pd/tests/client

go 1.19
go 1.20

require (
github.com/pingcap/failpoint v0.0.0-20210918120811-547c13e3eb00
Expand Down
2 changes: 1 addition & 1 deletion tests/mcs/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tikv/pd/tests/mcs

go 1.19
go 1.20

require (
github.com/pingcap/failpoint v0.0.0-20210918120811-547c13e3eb00
Expand Down
2 changes: 1 addition & 1 deletion tools/pd-heartbeat-bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (rs *Regions) init(cfg *config.Config) {
slice[i] = i
}

rand.Seed(0) // Ensure consistent behavior multiple times
rand.New(rand.NewSource(0)) // Ensure consistent behavior multiple times
pick := func(ratio float64) []int {
rand.Shuffle(cfg.RegionCount, func(i, j int) {
slice[i], slice[j] = slice[j], slice[i]
Expand Down

0 comments on commit 0469be5

Please sign in to comment.