From 3dbe7fc8a6dadfc529f021bd1c346b1f5ea76efa Mon Sep 17 00:00:00 2001 From: Randy Fay Date: Sat, 11 Feb 2023 16:26:25 -0700 Subject: [PATCH] Bump golang to v1.20, fixes #4443 (#4639) --- .ci-scripts/linux_arm64_setup.sh | 2 +- .github/workflows/colima-tests.yml | 2 +- .github/workflows/container-tests.yml | 2 +- .github/workflows/golangci-lint.yml | 5 ++--- .github/workflows/master-build.yml | 4 ++-- .github/workflows/pr-build.yml | 2 +- .github/workflows/tests.yml | 2 +- .gitpod/images/Dockerfile | 2 +- Makefile | 2 +- go.mod | 2 +- pkg/archive/archive.go | 2 -- pkg/fileutil/files.go | 2 +- pkg/util/utils.go | 4 ---- 13 files changed, 13 insertions(+), 20 deletions(-) diff --git a/.ci-scripts/linux_arm64_setup.sh b/.ci-scripts/linux_arm64_setup.sh index 8a653cf006c..54ecd989107 100755 --- a/.ci-scripts/linux_arm64_setup.sh +++ b/.ci-scripts/linux_arm64_setup.sh @@ -5,7 +5,7 @@ set -o errexit # Basic tools set -x -export GO_VERSION=1.19.4 +export GO_VERSION=1.20 if [ ! -z "${DOCKERHUB_PULL_USERNAME:-}" ]; then set +x diff --git a/.github/workflows/colima-tests.yml b/.github/workflows/colima-tests.yml index 9ecf3061bfc..d8c5f89e209 100644 --- a/.github/workflows/colima-tests.yml +++ b/.github/workflows/colima-tests.yml @@ -65,7 +65,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: '>=1.19.4' + go-version: '>=1.20' - name: Homebrew cache/restore uses: actions/cache@v3 diff --git a/.github/workflows/container-tests.yml b/.github/workflows/container-tests.yml index 1f7a8053bc5..3d5ccbb3cbc 100644 --- a/.github/workflows/container-tests.yml +++ b/.github/workflows/container-tests.yml @@ -64,7 +64,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: '>=1.19.4' + go-version: '>=1.20' - name: Build and test container ${{ matrix.containers }} run: | diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 1687021de4a..252ed4e669a 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -32,14 +32,13 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: '>=1.19.4' + go-version: '>=1.20' - uses: actions/checkout@v3 - run: echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH - name: golangci-lint uses: golangci/golangci-lint-action@v3 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.50 + version: latest # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/.github/workflows/master-build.yml b/.github/workflows/master-build.yml index b2c42f3c6cf..9241df11042 100644 --- a/.github/workflows/master-build.yml +++ b/.github/workflows/master-build.yml @@ -39,7 +39,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: '>=1.19.4' + go-version: '>=1.20' - name: Build DDEV executables run: make linux_amd64 linux_arm64 darwin_amd64 darwin_arm64 completions mkcert @@ -120,7 +120,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-go@v3 with: - go-version: '>=1.19.4' + go-version: '>=1.20' - name: restore build-most results from cache uses: actions/cache@v3 diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 29f53a5b7ce..62eb803dbc8 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -49,7 +49,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: '>=1.19.4' + go-version: '>=1.20' - name: Build DDEV executables run: make linux_amd64 linux_arm64 darwin_amd64 darwin_arm64 windows_amd64 windows_install diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8bfb522561a..e263aefc848 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -82,7 +82,7 @@ jobs: run: ./.github/workflows/linux-setup.sh - uses: actions/setup-go@v3 with: - go-version: '>=1.19.4' + go-version: '>=1.20' - name: Override environment variables for push-pull-test-platforms run: | diff --git a/.gitpod/images/Dockerfile b/.gitpod/images/Dockerfile index 43512a07e65..2f64915b406 100644 --- a/.gitpod/images/Dockerfile +++ b/.gitpod/images/Dockerfile @@ -14,7 +14,7 @@ RUN pip3 install mkdocs pyspelling pymdown-extensions RUN npm install -g markdownlint-cli RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v1.50.0 -RUN rm -rf /usr/local/go && curl -sL -o /tmp/go.tar.gz https://go.dev/dl/go1.19.2.linux-amd64.tar.gz && tar -C /usr/local -xzf /tmp/go.tar.gz && rm /tmp/go.tar.gz && ln -s /usr/local/go/bin/go /usr/local/bin/go +RUN rm -rf /usr/local/go && curl -sL -o /tmp/go.tar.gz https://go.dev/dl/go1.20.linux-amd64.tar.gz && tar -C /usr/local -xzf /tmp/go.tar.gz && rm /tmp/go.tar.gz && ln -s /usr/local/go/bin/go /usr/local/bin/go USER gitpod diff --git a/Makefile b/Makefile index 95a711f3c46..758e4eae472 100644 --- a/Makefile +++ b/Makefile @@ -77,7 +77,7 @@ $(TARGETS): mkcert $(GOFILES) @echo "building $@ from $(SRC_AND_UNDER)"; @#echo "LDFLAGS=$(LDFLAGS)"; @rm -f $@ - @export TARGET=$(word 3, $(subst /, ,$@)) && \ + export TARGET=$(word 3, $(subst /, ,$@)) && \ export GOOS="$${TARGET%_*}" GOARCH="$${TARGET#*_}" CGO_ENABLED=0 GOPATH="$(PWD)/$(GOTMP)" GOCACHE="$(PWD)/$(GOTMP)/.cache" && \ mkdir -p $(GOTMP)/{.cache,pkg,src,bin/$$TARGET} && \ chmod 777 $(GOTMP)/{.cache,pkg,src,bin/$$TARGET} && \ diff --git a/go.mod b/go.mod index b90d6c2be06..b0e9aa2ebb9 100644 --- a/go.mod +++ b/go.mod @@ -92,4 +92,4 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect ) -go 1.19 +go 1.20 diff --git a/pkg/archive/archive.go b/pkg/archive/archive.go index 2876a16517a..75e557dcb03 100644 --- a/pkg/archive/archive.go +++ b/pkg/archive/archive.go @@ -254,8 +254,6 @@ func Untar(source string, dest string, extractionDir string) error { } case tar.TypeReg: - fallthrough - case tar.TypeRegA: // Always ensure the directory is created before trying to move the file. fullPathDir := filepath.Dir(fullPath) err = os.MkdirAll(fullPathDir, 0755) diff --git a/pkg/fileutil/files.go b/pkg/fileutil/files.go index c3e1b6dbb2b..865307c9a1d 100644 --- a/pkg/fileutil/files.go +++ b/pkg/fileutil/files.go @@ -2,11 +2,11 @@ package fileutil import ( "bytes" + "crypto/rand" "encoding/hex" "fmt" "io" "io/fs" - "math/rand" "os" "path/filepath" "regexp" diff --git a/pkg/util/utils.go b/pkg/util/utils.go index 7afe7fe815e..9a2001cddc7 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -22,10 +22,6 @@ import ( "github.com/drud/ddev/pkg/output" ) -func init() { - rand.Seed(time.Now().UnixNano()) -} - // Failed will print a red error message and exit with failure. func Failed(format string, a ...interface{}) { format = ColorizeText(format, "red")