From d59b2713f694bad1f831a5cb2b06f2d76ae705ac Mon Sep 17 00:00:00 2001 From: jichangjun Date: Wed, 31 Aug 2022 16:30:19 +0800 Subject: [PATCH] feat: use go 1.19 --- .github/workflows/e2e_test_check.yml | 4 ++-- .github/workflows/golangci-lint.yml | 2 +- .github/workflows/release.yml | 14 +++++++------- .github/workflows/style_check.yml | 2 +- .github/workflows/ut_check.yml | 2 +- cmd/diff.go | 16 ++++++++-------- pkg/cover/cover.go | 2 +- pkg/cover/internal/tool/cover.go | 2 +- pkg/cover/server.go | 2 +- pkg/prow/job.go | 3 ++- tests/samples/gomod_replace_library/bar.go | 2 +- 11 files changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/e2e_test_check.yml b/.github/workflows/e2e_test_check.yml index 013938d7..2d1a5ba3 100644 --- a/.github/workflows/e2e_test_check.yml +++ b/.github/workflows/e2e_test_check.yml @@ -18,7 +18,7 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.18.x + go-version: 1.19.x - name: Checkout code uses: actions/checkout@v2 - name: Go build @@ -43,7 +43,7 @@ jobs: needs: job_1 strategy: matrix: - go-version: [1.16.x, 1.17.x, 1.18.x] + go-version: [1.16.x, 1.17.x, 1.18.x, 1.19.x] runs-on: ubuntu-latest steps: - name: Install Go diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index fccded96..2d2ad814 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -11,7 +11,7 @@ jobs: uses: golangci/golangci-lint-action@v2 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.45 + version: v1.49 # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fcb8856a..96317f68 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.18.x + go-version: 1.19.x - name: compile and release run: | ./ci-build.sh @@ -28,7 +28,7 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.18.x + go-version: 1.19.x - name: compile and release run: | ./ci-build.sh @@ -45,7 +45,7 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.18.x + go-version: 1.19.x - name: compile and release run: | ./ci-build.sh @@ -62,7 +62,7 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.18.x + go-version: 1.19.x - name: compile and release run: | ./ci-build.sh @@ -79,7 +79,7 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.18.x + go-version: 1.19.x - name: compile and release run: | ./ci-build.sh @@ -96,7 +96,7 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.18.x + go-version: 1.19.x - name: compile and release run: | ./ci-build.sh @@ -113,7 +113,7 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.18.x + go-version: 1.19.x - name: compile and release run: | ./ci-build.sh diff --git a/.github/workflows/style_check.yml b/.github/workflows/style_check.yml index 08f4ffd2..5dc91e96 100644 --- a/.github/workflows/style_check.yml +++ b/.github/workflows/style_check.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: # We have generics code, so only 1.18+ can work - go-version: [1.18.x] + go-version: [1.19.x] runs-on: ubuntu-latest steps: - name: Install Go diff --git a/.github/workflows/ut_check.yml b/.github/workflows/ut_check.yml index e1f94b61..315fe7ca 100644 --- a/.github/workflows/ut_check.yml +++ b/.github/workflows/ut_check.yml @@ -15,7 +15,7 @@ jobs: name: go test strategy: matrix: - go-version: [1.16.x, 1.17.x, 1.18.x] + go-version: [1.16.x, 1.17.x, 1.18.x, 1.19.x] runs-on: ubuntu-latest steps: - name: Install Go diff --git a/cmd/diff.go b/cmd/diff.go index 6ad26c9d..a03a735a 100644 --- a/cmd/diff.go +++ b/cmd/diff.go @@ -98,14 +98,14 @@ func init() { rootCmd.AddCommand(diffCmd) } -//goc diff --new-profile=./new.cov --base-profile=./base.cov -//+------------------------------------------------------+---------------+--------------+--------+ -//| File | Base Coverage | New Coverage | Delta | -//+------------------------------------------------------+---------------+--------------+--------+ -//| qiniu.com/kodo/bd/pfd/pfdstg/cursor/mgr.go | 53.5% | 50.5% | -3.0% | -//| qiniu.com/kodo/bd/pfd/pfdstg/svr/getstripe.go | 0.5% | 0.0% | -0.5% | -//| Total | 35.7% | 35.7% | -0.0% | -//+------------------------------------------------------+---------------+--------------+--------+ +// goc diff --new-profile=./new.cov --base-profile=./base.cov +// +------------------------------------------------------+---------------+--------------+--------+ +// | File | Base Coverage | New Coverage | Delta | +// +------------------------------------------------------+---------------+--------------+--------+ +// | qiniu.com/kodo/bd/pfd/pfdstg/cursor/mgr.go | 53.5% | 50.5% | -3.0% | +// | qiniu.com/kodo/bd/pfd/pfdstg/svr/getstripe.go | 0.5% | 0.0% | -0.5% | +// | Total | 35.7% | 35.7% | -0.0% | +// +------------------------------------------------------+---------------+--------------+--------+ func doDiffForLocalProfiles(cmd *cobra.Command, args []string) { localP, err := cover.ReadFileToCoverList(newProfile) if err != nil { diff --git a/pkg/cover/cover.go b/pkg/cover/cover.go index 2639ce2b..07455651 100644 --- a/pkg/cover/cover.go +++ b/pkg/cover/cover.go @@ -143,7 +143,7 @@ type CoverInfo struct { Singleton bool } -//Execute inject cover variables for all the .go files in the target folder +// Execute inject cover variables for all the .go files in the target folder func Execute(coverInfo *CoverInfo) error { target := coverInfo.Target newGopath := coverInfo.GoPath diff --git a/pkg/cover/internal/tool/cover.go b/pkg/cover/internal/tool/cover.go index 283f535c..56e4a441 100644 --- a/pkg/cover/internal/tool/cover.go +++ b/pkg/cover/internal/tool/cover.go @@ -423,7 +423,7 @@ func (f *File) newCounter(start, end token.Pos, numStmt int) string { // S1 // if cond { // S2 -// } +// } // S3 // // counters will be added before S1 and before S3. The block containing S2 diff --git a/pkg/cover/server.go b/pkg/cover/server.go index 2c3f36db..0955c87e 100644 --- a/pkg/cover/server.go +++ b/pkg/cover/server.go @@ -115,7 +115,7 @@ type ProfileParam struct { SkipFilePatterns []string `form:"skipfile" json:"skipfile"` } -//listServices list all the registered services +// listServices list all the registered services func (s *server) listServices(c *gin.Context) { services := s.Store.GetAll() c.JSON(http.StatusOK, services) diff --git a/pkg/prow/job.go b/pkg/prow/job.go index cebcdad5..0de7aefc 100644 --- a/pkg/prow/job.go +++ b/pkg/prow/job.go @@ -131,7 +131,8 @@ func (j *Job) RunPeriodic() error { return nil } -//trim github filename to profile format: +// trim github filename to profile format: +// // src/qiniu.com/kodo/io/io/io_svr.go -> qiniu.com/kodo/io/io/io_svr.go func trimGhFileToProfile(ghFiles []string) (pFiles []string) { //TODO: need compatible other situation diff --git a/tests/samples/gomod_replace_library/bar.go b/tests/samples/gomod_replace_library/bar.go index 741f116e..9376a49e 100644 --- a/tests/samples/gomod_replace_library/bar.go +++ b/tests/samples/gomod_replace_library/bar.go @@ -2,7 +2,7 @@ package foo import "fmt" -//Bar fake method +// Bar fake method func Bar() { fmt.Println("foo bar") }