Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v0.10 backport] update to Go 1.19 #3146

Closed
wants to merge 12 commits into from
7 changes: 4 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ env:
CACHE_GHA_SCOPE_IT: "integration-tests"
CACHE_GHA_SCOPE_BINARIES: "binaries"
CACHE_GHA_SCOPE_CROSS: "cross"
TESTFLAGS: "-v --parallel=6 --timeout=30m"
BUILDX_VERSION: "v0.8.2" # leave empty to use the one available on GitHub virtual environment
GO_VERSION: "1.19"

jobs:
base:
Expand Down Expand Up @@ -108,7 +110,6 @@ jobs:
-
name: Test pkg=${{ matrix.pkg }} ; typ=${{ matrix.typ }} ; skipit=${{ matrix.skip-integration-tests }} ; worker=${{ matrix.worker }}
run: |
export TESTFLAGS="-v --parallel=6 --timeout=20m"
if [ -n "${{ matrix.worker }}" ]; then
export TESTFLAGS="${TESTFLAGS} --run=//worker=${{ matrix.worker }}$"
fi
Expand Down Expand Up @@ -143,7 +144,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: ${{ env.GO_VERSION }}
-
name: Cache Go modules
uses: actions/cache@v2
Expand All @@ -163,7 +164,7 @@ jobs:
SKIP_INTEGRATION_TESTS: 1
run: |
mkdir -p ./coverage
go test -coverprofile=./coverage/coverage-${{ github.job }}-${{ matrix.os }}.txt -covermode=atomic ./...
go test -coverprofile=./coverage/coverage-${{ github.job }}-${{ matrix.os }}.txt -covermode=atomic ${TESTFLAGS} ./...
shell: bash
-
name: Upload coverage file
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/dockerd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ env:
REPO_SLUG_ORIGIN: "moby/buildkit:latest"
CACHE_GHA_SCOPE_IT: "integration-tests"
CACHE_GHA_SCOPE_BINARIES: "binaries"
TESTFLAGS: "-v --parallel=1 --timeout=30m"
BUILDX_VERSION: "v0.8.2" # leave empty to use the one available on GitHub virtual environment

jobs:
prepare:
Expand Down Expand Up @@ -43,6 +45,7 @@ jobs:
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: ${{ env.BUILDX_VERSION }}
driver-opts: image=${{ env.REPO_SLUG_ORIGIN }}
buildkitd-flags: --debug
-
Expand Down Expand Up @@ -107,6 +110,7 @@ jobs:
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: ${{ env.BUILDX_VERSION }}
driver-opts: image=${{ env.REPO_SLUG_ORIGIN }}
buildkitd-flags: --debug
-
Expand Down Expand Up @@ -134,6 +138,6 @@ jobs:
TEST_DOCKERD: "1"
TEST_DOCKERD_BINARY: "./build/dockerd"
TESTPKGS: "${{ matrix.pkg }}"
TESTFLAGS: "-v --parallel=1 --timeout=30m --run=//worker=dockerd$"
TESTFLAGS: "${{ env.TESTFLAGS }} --run=//worker=dockerd$"
SKIP_INTEGRATION_TESTS: "${{ matrix.skip-integration-tests }}"
CACHE_FROM: "type=gha,scope=${{ env.CACHE_GHA_SCOPE_IT }} type=gha,scope=${{ env.CACHE_GHA_SCOPE_BINARIES }}"
8 changes: 8 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ run:
linters:
enable:
- deadcode
- depguard
- gofmt
- goimports
- revive
Expand All @@ -30,6 +31,13 @@ linters:
disable-all: true

linters-settings:
depguard:
list-type: blacklist
include-go-root: true
packages:
# The io/ioutil package has been deprecated.
# https://go.dev/doc/go1.16#ioutil
- io/ioutil
importas:
alias:
- pkg: "github.com/opencontainers/image-spec/specs-go/v1"
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN apk add --no-cache git
# xx is a helper for cross-compilation
FROM --platform=$BUILDPLATFORM tonistiigi/xx@sha256:1e96844fadaa2f9aea021b2b05299bc02fe4c39a92d8e735b93e8e2b15610128 AS xx

FROM --platform=$BUILDPLATFORM golang:1.17-alpine AS golatest
FROM --platform=$BUILDPLATFORM golang:1.19-alpine AS golatest

# gobuild is base stage for compiling go/cgo
FROM golatest AS gobuild-base
Expand Down Expand Up @@ -123,7 +123,7 @@ RUN git clone https://github.com/containerd/containerd.git containerd
FROM gobuild-base AS containerd-base
WORKDIR /go/src/github.com/containerd/containerd
ARG TARGETPLATFORM
ENV CGO_ENABLED=1 BUILDTAGS=no_btrfs
ENV CGO_ENABLED=1 BUILDTAGS=no_btrfs GO111MODULE=off
RUN xx-apk add musl-dev gcc && xx-go --wrap

FROM containerd-base AS containerd
Expand Down
37 changes: 18 additions & 19 deletions cache/contenthash/checksum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -43,7 +42,7 @@ const (

func TestChecksumSymlinkNoParentScan(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -72,7 +71,7 @@ func TestChecksumSymlinkNoParentScan(t *testing.T) {

func TestChecksumHardlinks(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -155,7 +154,7 @@ func TestChecksumHardlinks(t *testing.T) {

func TestChecksumWildcardOrFilter(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -212,7 +211,7 @@ func TestChecksumWildcardOrFilter(t *testing.T) {

func TestChecksumWildcardWithBadMountable(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand All @@ -232,7 +231,7 @@ func TestChecksumWildcardWithBadMountable(t *testing.T) {

func TestSymlinksNoFollow(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -291,7 +290,7 @@ func TestSymlinksNoFollow(t *testing.T) {

func TestChecksumBasicFile(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -449,7 +448,7 @@ func TestChecksumIncludeExclude(t *testing.T) {
func testChecksumIncludeExclude(t *testing.T, wildcard bool) {
t.Parallel()

tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -584,7 +583,7 @@ func testChecksumIncludeExclude(t *testing.T, wildcard bool) {

func TestChecksumIncludeDoubleStar(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -652,7 +651,7 @@ func TestChecksumIncludeDoubleStar(t *testing.T) {

func TestChecksumIncludeSymlink(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -725,7 +724,7 @@ func TestChecksumIncludeSymlink(t *testing.T) {

func TestHandleChange(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -803,7 +802,7 @@ func TestHandleChange(t *testing.T) {

func TestHandleRecursiveDir(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -852,7 +851,7 @@ func TestHandleRecursiveDir(t *testing.T) {

func TestChecksumUnorderedFiles(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -905,7 +904,7 @@ func TestChecksumUnorderedFiles(t *testing.T) {

func TestSymlinkInPathScan(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -936,7 +935,7 @@ func TestSymlinkInPathScan(t *testing.T) {

func TestSymlinkNeedsScan(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -969,7 +968,7 @@ func TestSymlinkNeedsScan(t *testing.T) {

func TestSymlinkAbsDirSuffix(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand All @@ -996,7 +995,7 @@ func TestSymlinkAbsDirSuffix(t *testing.T) {

func TestSymlinkThroughParent(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -1051,7 +1050,7 @@ func TestSymlinkThroughParent(t *testing.T) {

func TestSymlinkInPathHandleChange(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down Expand Up @@ -1114,7 +1113,7 @@ func TestSymlinkInPathHandleChange(t *testing.T) {

func TestPersistence(t *testing.T) {
t.Parallel()
tmpdir, err := ioutil.TempDir("", "buildkit-state")
tmpdir, err := os.MkdirTemp("", "buildkit-state")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)

Expand Down
Loading