Merge pull request #1643 from crazy-max/go-1.20

update to go 1.20
pull/1646/head
CrazyMax 2 years ago committed by GitHub
commit 71507c0b58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,13 +11,11 @@ linters:
enable:
- gofmt
- govet
- deadcode
- depguard
- goimports
- ineffassign
- misspell
- unused
- varcheck
- revive
- staticcheck
- typecheck

@ -1,6 +1,6 @@
# syntax=docker/dockerfile-upstream:1.5.0
ARG GO_VERSION=1.19
ARG GO_VERSION=1.20
ARG XX_VERSION=1.1.2
ARG DOCKERD_VERSION=20.10.14

@ -10,8 +10,6 @@ import (
)
func TestReadTargets(t *testing.T) {
t.Parallel()
fp := File{
Name: "config.hcl",
Data: []byte(`
@ -35,6 +33,7 @@ target "webapp" {
ctx := context.TODO()
t.Run("NoOverrides", func(t *testing.T) {
t.Parallel()
m, g, err := ReadTargets(ctx, []File{fp}, []string{"webapp"}, nil, nil)
require.NoError(t, err)
require.Equal(t, 1, len(m))
@ -50,6 +49,7 @@ target "webapp" {
})
t.Run("InvalidTargetOverrides", func(t *testing.T) {
t.Parallel()
_, _, err := ReadTargets(ctx, []File{fp}, []string{"webapp"}, []string{"nosuchtarget.context=foo"}, nil)
require.NotNil(t, err)
require.Equal(t, err.Error(), "could not find any target matching 'nosuchtarget'")
@ -91,6 +91,7 @@ target "webapp" {
// building leaf but overriding parent fields
t.Run("parent", func(t *testing.T) {
t.Parallel()
m, g, err := ReadTargets(ctx, []File{fp}, []string{"webapp"}, []string{
"webDEP.args.VAR_INHERITED=override",
"webDEP.args.VAR_BOTH=override",
@ -105,6 +106,7 @@ target "webapp" {
})
t.Run("ContextOverride", func(t *testing.T) {
t.Parallel()
_, _, err := ReadTargets(ctx, []File{fp}, []string{"webapp"}, []string{"webapp.context"}, nil)
require.NotNil(t, err)
@ -116,6 +118,7 @@ target "webapp" {
})
t.Run("NoCacheOverride", func(t *testing.T) {
t.Parallel()
m, g, err := ReadTargets(ctx, []File{fp}, []string{"webapp"}, []string{"webapp.no-cache=false"}, nil)
require.NoError(t, err)
require.Equal(t, false, *m["webapp"].NoCache)
@ -124,6 +127,7 @@ target "webapp" {
})
t.Run("PullOverride", func(t *testing.T) {
t.Parallel()
m, g, err := ReadTargets(ctx, []File{fp}, []string{"webapp"}, []string{"webapp.pull=false"}, nil)
require.NoError(t, err)
require.Equal(t, false, *m["webapp"].Pull)
@ -132,6 +136,7 @@ target "webapp" {
})
t.Run("PatternOverride", func(t *testing.T) {
t.Parallel()
// same check for two cases
multiTargetCheck := func(t *testing.T, m map[string]*Target, g map[string]*Group, err error) {
require.NoError(t, err)

@ -946,7 +946,7 @@ func TestVarUnsupportedType(t *testing.T) {
}
func ptrstr(s interface{}) *string {
var n *string = nil
var n *string
if reflect.ValueOf(s).Kind() == reflect.String {
ss := s.(string)
n = &ss

@ -1,5 +1,5 @@
variable "GO_VERSION" {
default = "1.19"
default = "1.20"
}
variable "DOCS_FORMATS" {
default = "md"

@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.4
ARG GO_VERSION=1.19
ARG GO_VERSION=1.20
ARG FORMATS=md,yaml
FROM golang:${GO_VERSION}-alpine AS docsgen

@ -5,7 +5,7 @@
# Copyright The Buildx Authors.
# Licensed under the Apache License, Version 2.0
ARG GO_VERSION="1.19"
ARG GO_VERSION="1.20"
ARG PROTOC_VERSION="3.11.4"
# protoc is dynamically linked to glibc so can't use alpine base

@ -1,10 +1,10 @@
# syntax=docker/dockerfile:1.4
ARG GO_VERSION=1.19
ARG GO_VERSION=1.20
FROM golang:${GO_VERSION}-alpine
RUN apk add --no-cache git gcc musl-dev
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.48.0
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.51.1
WORKDIR /go/src/github.com/docker/buildx
RUN --mount=target=/go/src/github.com/docker/buildx --mount=target=/root/.cache,type=cache \
golangci-lint run

@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.4
ARG GO_VERSION=1.19
ARG GO_VERSION=1.20
ARG MODOUTDATED_VERSION=v0.8.0
FROM golang:${GO_VERSION}-alpine AS base

Loading…
Cancel
Save