From cd1dbb310be87d7fda487d46b56c9571aeecfbb0 Mon Sep 17 00:00:00 2001 From: yxxhero Date: Sun, 3 Jul 2022 09:15:50 +0800 Subject: [PATCH] bump Go 1.18 Signed-off-by: yxxhero --- .circleci/config.yml | 4 ++-- .github/workflows/build-pr.yml | 6 +++--- cmd/helm/docs.go | 4 +++- go.mod | 4 ++-- internal/test/test.go | 4 ++-- pkg/chartutil/values.go | 2 +- scripts/coverage.sh | 2 +- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7a9c4874d..36e137bfd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ jobs: build: working_directory: ~/helm.sh/helm docker: - - image: circleci/golang:1.17 + - image: cimg/go:1.18 auth: username: $DOCKER_USER @@ -13,7 +13,7 @@ jobs: environment: GOCACHE: "/tmp/go/cache" - GOLANGCI_LINT_VERSION: "1.43.0" + GOLANGCI_LINT_VERSION: "1.46.2" steps: - checkout diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index f08a43ef3..a8ad9b8c7 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -12,7 +12,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v2 with: - go-version: '1.17' + go-version: '1.18' - name: Install golangci-lint run: | curl -sSLO https://github.com/golangci/golangci-lint/releases/download/v$GOLANGCI_LINT_VERSION/golangci-lint-$GOLANGCI_LINT_VERSION-linux-amd64.tar.gz @@ -21,8 +21,8 @@ jobs: sudo mv golangci-lint-$GOLANGCI_LINT_VERSION-linux-amd64/golangci-lint /usr/local/bin/golangci-lint rm -rf golangci-lint-$GOLANGCI_LINT_VERSION-linux-amd64* env: - GOLANGCI_LINT_VERSION: '1.43.0' - GOLANGCI_LINT_SHA256: 'f3515cebec926257da703ba0a2b169e4a322c11dc31a8b4656b50a43e48877f4' + GOLANGCI_LINT_VERSION: '1.46.2' + GOLANGCI_LINT_SHA256: '242cd4f2d6ac0556e315192e8555784d13da5d1874e51304711570769c4f2b9b' - name: Test style run: make test-style - name: Run unit tests diff --git a/cmd/helm/docs.go b/cmd/helm/docs.go index ef64d41a5..26fc91446 100644 --- a/cmd/helm/docs.go +++ b/cmd/helm/docs.go @@ -25,6 +25,8 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/cobra/doc" + "golang.org/x/text/cases" + "golang.org/x/text/language" "helm.sh/helm/v3/cmd/helm/require" ) @@ -84,7 +86,7 @@ func (o *docsOptions) run(out io.Writer) error { hdrFunc := func(filename string) string { base := filepath.Base(filename) name := strings.TrimSuffix(base, path.Ext(base)) - title := strings.Title(strings.Replace(name, "_", " ", -1)) + title := cases.Title(language.Und).String(strings.Replace(name, "_", " ", -1)) return fmt.Sprintf("---\ntitle: \"%s\"\n---\n\n", title) } diff --git a/go.mod b/go.mod index 877bfb388..28ec4d927 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module helm.sh/helm/v3 -go 1.17 +go 1.18 require ( github.com/BurntSushi/toml v1.1.0 @@ -33,6 +33,7 @@ require ( github.com/xeipuuv/gojsonschema v1.2.0 golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 + golang.org/x/text v0.3.7 k8s.io/api v0.24.1 k8s.io/apiextensions-apiserver v0.24.1 k8s.io/apimachinery v0.24.1 @@ -147,7 +148,6 @@ require ( golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect - golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect diff --git a/internal/test/test.go b/internal/test/test.go index 0de3210c4..4d5862c70 100644 --- a/internal/test/test.go +++ b/internal/test/test.go @@ -45,7 +45,7 @@ func AssertGoldenString(t TestingT, actual, filename string) { t.Helper() if err := compare([]byte(actual), path(filename)); err != nil { - t.Fatalf("%v", err) + t.Fatalf("%v\n", err) } } @@ -79,7 +79,7 @@ func compare(actual []byte, filename string) error { } expected = normalize(expected) if !bytes.Equal(expected, actual) { - return errors.Errorf("does not match golden file %s\n\nWANT:\n'%s'\n\nGOT:\n'%s'\n", filename, expected, actual) + return errors.Errorf("does not match golden file %s\n\nWANT:\n'%s'\n\nGOT:\n'%s'", filename, expected, actual) } return nil } diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index e1cdf4642..97bf44217 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -68,7 +68,7 @@ func (v Values) Table(name string) (Values, error) { // // It protects against nil map panics. func (v Values) AsMap() map[string]interface{} { - if v == nil || len(v) == 0 { + if len(v) == 0 { return map[string]interface{}{} } return v diff --git a/scripts/coverage.sh b/scripts/coverage.sh index bdbfaa991..dcdc80735 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -21,7 +21,7 @@ coverdir=$(mktemp -d /tmp/coverage.XXXXXXXXXX) profile="${coverdir}/cover.out" pushd / -hash goveralls 2>/dev/null || go get github.com/mattn/goveralls +hash goveralls 2>/dev/null || go install github.com/mattn/goveralls@v0.0.11 popd generate_cover_data() {