From 64a38aa5a65925495df38980505acabd768f259a Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Mon, 11 Jul 2022 20:59:28 +0200 Subject: [PATCH] go 1.18 Signed-off-by: CrazyMax --- .golangci.yml | 31 ++++++++++++++++++++++-------- Dockerfile | 4 ++-- cmd/binfmt/config.go | 1 + go.mod | 2 +- hack/dockerfiles/lint.Dockerfile | 6 +++--- hack/dockerfiles/vendor.Dockerfile | 5 +++-- test/Dockerfile | 8 ++++---- test/go.mod | 2 +- 8 files changed, 38 insertions(+), 21 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 650a90aa..0b22a0b0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,26 +7,41 @@ run: build-tags: - dfrunsecurity - - dfrunnetwork linters: enable: - - gofmt - - govet - deadcode + - depguard + - gofmt - goimports + - gosimple + - revive + - govet + - importas - ineffassign - misspell - - unused - - varcheck - - golint - staticcheck - - typecheck - structcheck + - typecheck + - unused + - varcheck + - bodyclose + - errname + - makezero + - whitespace 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 + issues: exclude-rules: - linters: - - golint + - revive text: "stutters" diff --git a/Dockerfile b/Dockerfile index 2778f9ff..cbda9f76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -# syntax=docker/dockerfile:1.3-labs +# syntax=docker/dockerfile:1 -ARG GO_VERSION=1.17 +ARG GO_VERSION=1.18 ARG ALPINE_VERSION=3.16 ARG ALPINE_BASE=alpine:${ALPINE_VERSION} diff --git a/cmd/binfmt/config.go b/cmd/binfmt/config.go index 2e549395..4909600c 100644 --- a/cmd/binfmt/config.go +++ b/cmd/binfmt/config.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package main diff --git a/go.mod b/go.mod index a1acb10e..4f34d3ae 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/tonistiigi/binfmt -go 1.17 +go 1.18 require ( github.com/containerd/containerd v1.5.8 diff --git a/hack/dockerfiles/lint.Dockerfile b/hack/dockerfiles/lint.Dockerfile index c6f97bca..03e2c548 100644 --- a/hack/dockerfiles/lint.Dockerfile +++ b/hack/dockerfiles/lint.Dockerfile @@ -1,8 +1,8 @@ -# syntax=docker/dockerfile:1.2 +# syntax=docker/dockerfile:1 -FROM golang:1.17-alpine +FROM golang:1.18-alpine RUN apk add --no-cache gcc musl-dev -RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.39.0 +RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.45.0 WORKDIR /go/src/github.com/tonistiigi/binfmt RUN --mount=target=. --mount=target=/root/.cache,type=cache \ golangci-lint run diff --git a/hack/dockerfiles/vendor.Dockerfile b/hack/dockerfiles/vendor.Dockerfile index ea4daa6f..21bcbf17 100644 --- a/hack/dockerfiles/vendor.Dockerfile +++ b/hack/dockerfiles/vendor.Dockerfile @@ -1,5 +1,6 @@ -# syntax = docker/dockerfile:1.2 -FROM golang:1.17-alpine AS vendored +# syntax=docker/dockerfile:1 + +FROM golang:1.18-alpine AS vendored RUN apk add --no-cache git WORKDIR /src RUN --mount=target=/src,rw \ diff --git a/test/Dockerfile b/test/Dockerfile index 7c86aeb9..d1d14cdc 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -1,11 +1,11 @@ -#syntax=docker/dockerfile:1.3-labs +#syntax=docker/dockerfile:1-labs -FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.1.0 AS xx +FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.1.1 AS xx FROM scratch AS src COPY *.go go.* / -FROM --platform=$BUILDPLATFORM golang:1.17-alpine AS build +FROM --platform=$BUILDPLATFORM golang:1.18-alpine AS build COPY --from=xx / / RUN apk add clang lld file ARG TARGETPLATFORM @@ -27,4 +27,4 @@ COPY --from=binary / /usr/bin ARG CONFIG_RT_GROUP_SCHED RUN --security=insecure REEXEC_NAME=/usr/bin/test /usr/bin/test -test.v -FROM binary \ No newline at end of file +FROM binary diff --git a/test/go.mod b/test/go.mod index f1eee0a9..a4679a45 100644 --- a/test/go.mod +++ b/test/go.mod @@ -1,6 +1,6 @@ module github.com/tonistiigi/binfmt/test -go 1.17 +go 1.18 require ( github.com/stretchr/testify v1.7.0