Skip to content

Commit

Permalink
Merge pull request #3022 from crazy-max/go-1.19
Browse files Browse the repository at this point in the history
update to Go 1.19
  • Loading branch information
tonistiigi authored Aug 25, 2022
2 parents bb85fe7 + 4a15e74 commit c07a656
Show file tree
Hide file tree
Showing 25 changed files with 43 additions and 46 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ env:
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 @@ -170,7 +171,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: ${{ env.GO_VERSION }}
-
name: Cache Go modules
uses: actions/cache@v2
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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.18-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
7 changes: 4 additions & 3 deletions cache/refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1590,9 +1590,10 @@ func (p sharableMountPool) setSharable(mounts snapshot.Mountable) snapshot.Mount
// This is useful to share writable overlayfs mounts.
//
// NOTE: Mount() method doesn't return the underlying mount configuration (e.g. overlayfs mounts)
// instead it always return bind mounts of the temporary mount point. So if the caller
// needs to inspect the underlying mount configuration (e.g. for optimized differ for
// overlayfs), this wrapper shouldn't be used.
//
// instead it always return bind mounts of the temporary mount point. So if the caller
// needs to inspect the underlying mount configuration (e.g. for optimized differ for
// overlayfs), this wrapper shouldn't be used.
type sharableMountable struct {
snapshot.Mountable

Expand Down
2 changes: 1 addition & 1 deletion examples/buildkit0/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
}

func goBuildBase() llb.State {
goAlpine := llb.Image("docker.io/library/golang:1.18-alpine")
goAlpine := llb.Image("docker.io/library/golang:1.19-alpine")
return goAlpine.
AddEnv("PATH", "/usr/local/go/bin:"+system.DefaultPathEnvUnix).
AddEnv("GOPATH", "/go").
Expand Down
2 changes: 1 addition & 1 deletion examples/buildkit1/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
}

func goBuildBase() llb.State {
goAlpine := llb.Image("docker.io/library/golang:1.18-alpine")
goAlpine := llb.Image("docker.io/library/golang:1.19-alpine")
return goAlpine.
AddEnv("PATH", "/usr/local/go/bin:"+system.DefaultPathEnvUnix).
AddEnv("GOPATH", "/go").
Expand Down
2 changes: 1 addition & 1 deletion examples/buildkit2/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
}

func goBuildBase() llb.State {
goAlpine := llb.Image("docker.io/library/golang:1.18-alpine")
goAlpine := llb.Image("docker.io/library/golang:1.19-alpine")
return goAlpine.
AddEnv("PATH", "/usr/local/go/bin:"+system.DefaultPathEnvUnix).
AddEnv("GOPATH", "/go").
Expand Down
2 changes: 1 addition & 1 deletion examples/buildkit3/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func main() {
}

func goBuildBase() llb.State {
goAlpine := llb.Image("docker.io/library/golang:1.18-alpine")
goAlpine := llb.Image("docker.io/library/golang:1.19-alpine")
return goAlpine.
AddEnv("PATH", "/usr/local/go/bin:"+system.DefaultPathEnvUnix).
AddEnv("GOPATH", "/go").
Expand Down
2 changes: 1 addition & 1 deletion examples/buildkit4/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func main() {
}

func goBuildBase() llb.State {
goAlpine := llb.Image("docker.io/library/golang:1.18-alpine")
goAlpine := llb.Image("docker.io/library/golang:1.19-alpine")
return goAlpine.
AddEnv("PATH", "/usr/local/go/bin:"+system.DefaultPathEnvUnix).
AddEnv("GOPATH", "/go").
Expand Down
2 changes: 1 addition & 1 deletion examples/nested-llb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func main() {
}

func goBuildBase() llb.State {
goAlpine := llb.Image("docker.io/library/golang:1.18-alpine")
goAlpine := llb.Image("docker.io/library/golang:1.19-alpine")
return goAlpine.
AddEnv("PATH", "/usr/local/go/bin:"+system.DefaultPathEnvUnix).
AddEnv("GOPATH", "/go").
Expand Down
2 changes: 1 addition & 1 deletion frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# xx is a helper for cross-compilation
FROM --platform=$BUILDPLATFORM tonistiigi/xx:golang@sha256:810dc54d5144f133a218e88e319184bf8b9ce01d37d46ddb37573e90decd9eef AS xx

FROM --platform=$BUILDPLATFORM golang:1.18-alpine AS base
FROM --platform=$BUILDPLATFORM golang:1.19-alpine AS base
RUN apk add git bash
COPY --from=xx / /
WORKDIR /src
Expand Down
4 changes: 3 additions & 1 deletion frontend/dockerfile/instructions/bflag.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ func (fl *Flag) IsTrue() bool {
// compile time error so it doesn't matter too much when we stop our
// processing as long as we do stop it, so this allows the code
// around AddXXX() to be just:
// defFlag := AddString("description", "")
//
// defFlag := AddString("description", "")
//
// w/o needing to add an if-statement around each one.
func (bf *BFlags) Parse() error {
// If there was an error while defining the possible flags
Expand Down
11 changes: 0 additions & 11 deletions frontend/dockerfile/instructions/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ func NewLabelCommand(k string, v string, NoExp bool) *LabelCommand {
// LabelCommand : LABEL some json data describing the image
//
// Sets the Label variable foo to bar,
//
type LabelCommand struct {
withNameAndCode
Labels KeyValuePairs // kvp slice instead of map to preserve ordering
Expand Down Expand Up @@ -220,7 +219,6 @@ func (s *SourcesAndDest) ExpandRaw(expander SingleWordExpander) error {
//
// Add the file 'foo' to '/path'. Tarball and Remote URL (http, https) handling
// exist here. If you do not wish to have this automatic handling, use COPY.
//
type AddCommand struct {
withNameAndCode
SourcesAndDest
Expand All @@ -244,7 +242,6 @@ func (c *AddCommand) Expand(expander SingleWordExpander) error {
// CopyCommand : COPY foo /path
//
// Same as 'ADD' but without the tar and remote url handling.
//
type CopyCommand struct {
withNameAndCode
SourcesAndDest
Expand Down Expand Up @@ -274,7 +271,6 @@ type OnbuildCommand struct {
// WorkdirCommand : WORKDIR /tmp
//
// Set the working directory for future RUN/CMD/etc statements.
//
type WorkdirCommand struct {
withNameAndCode
Path string
Expand Down Expand Up @@ -313,7 +309,6 @@ type ShellDependantCmdLine struct {
// RUN echo hi # sh -c echo hi (Linux)
// RUN echo hi # cmd /S /C echo hi (Windows)
// RUN [ "echo", "hi" ] # echo hi
//
type RunCommand struct {
withNameAndCode
withExternalData
Expand All @@ -332,7 +327,6 @@ func (c *RunCommand) Expand(expander SingleWordExpander) error {
//
// Set the default command to run in the container (which may be empty).
// Argument handling is the same as RUN.
//
type CmdCommand struct {
withNameAndCode
ShellDependantCmdLine
Expand All @@ -342,7 +336,6 @@ type CmdCommand struct {
//
// Set the default healthcheck command to run in the container (which may be empty).
// Argument handling is the same as RUN.
//
type HealthCheckCommand struct {
withNameAndCode
Health *container.HealthConfig
Expand All @@ -355,7 +348,6 @@ type HealthCheckCommand struct {
//
// Handles command processing similar to CMD and RUN, only req.runConfig.Entrypoint
// is initialized at newBuilder time instead of through argument parsing.
//
type EntrypointCommand struct {
withNameAndCode
ShellDependantCmdLine
Expand All @@ -365,7 +357,6 @@ type EntrypointCommand struct {
//
// Expose ports for links and port mappings. This all ends up in
// req.runConfig.ExposedPorts for runconfig.
//
type ExposeCommand struct {
withNameAndCode
Ports []string
Expand All @@ -375,7 +366,6 @@ type ExposeCommand struct {
//
// Set the user to 'foo' for future commands and when running the
// ENTRYPOINT/CMD at container run time.
//
type UserCommand struct {
withNameAndCode
User string
Expand All @@ -394,7 +384,6 @@ func (c *UserCommand) Expand(expander SingleWordExpander) error {
// VolumeCommand : VOLUME /foo
//
// Expose the volume /foo for use. Will also accept the JSON array form.
//
type VolumeCommand struct {
withNameAndCode
Volumes []string
Expand Down
12 changes: 6 additions & 6 deletions frontend/dockerfile/parser/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ var invalidJSONArraysOfStrings = []string{
}

var validJSONArraysOfStrings = map[string][]string{
`[]`: {},
`[""]`: {""},
`["a"]`: {"a"},
`["a","b"]`: {"a", "b"},
`[ "a", "b" ]`: {"a", "b"},
`[ "a", "b" ]`: {"a", "b"},
`[]`: {},
`[""]`: {""},
`["a"]`: {"a"},
`["a","b"]`: {"a", "b"},
`[ "a", "b" ]`: {"a", "b"},
`[ "a", "b" ]`: {"a", "b"},
` [ "a", "b" ] `: {"a", "b"},
`["abc 123", "♥", "☃", "\" \\ \/ \b \f \n \r \t \u0000"]`: {"abc 123", "♥", "☃", "\" \\ / \b \f \n \r \t \u0000"},
}
Expand Down
1 change: 0 additions & 1 deletion frontend/dockerfile/parser/line_parsers.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func parseIgnore(rest string, d *directives) (*Node, map[string]bool, error) {
// statement with sub-statements.
//
// ONBUILD RUN foo bar -> (onbuild (run foo bar))
//
func parseSubCommand(rest string, d *directives) (*Node, map[string]bool, error) {
if rest == "" {
return nil, nil, nil
Expand Down
1 change: 0 additions & 1 deletion frontend/dockerfile/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
// This data structure is frankly pretty lousy for handling complex languages,
// but lucky for us the Dockerfile isn't very complicated. This structure
// works a little more effectively than a "proper" parse tree for our needs.
//
type Node struct {
Value string // actual content
Next *Node // the next item in the current sexp
Expand Down
2 changes: 2 additions & 0 deletions frontend/gateway/pb/gateway.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hack/dockerfiles/generated-files.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile-upstream:master

# protoc is dynamically linked to glibc to can't use golang:1.10-alpine
FROM golang:1.18-buster AS gobuild-base
FROM golang:1.19-buster AS gobuild-base

RUN apt-get update && apt-get --no-install-recommends install -y \
unzip \
Expand Down
4 changes: 2 additions & 2 deletions hack/dockerfiles/lint.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# syntax=docker/dockerfile-upstream:master

FROM golang:1.18-alpine
FROM golang:1.19-alpine
ENV GOFLAGS="-buildvcs=false"
RUN apk add --no-cache gcc musl-dev yamllint
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.47.3
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.48.0
WORKDIR /go/src/github.com/moby/buildkit
RUN --mount=target=/go/src/github.com/moby/buildkit --mount=target=/root/.cache,type=cache \
GOARCH=amd64 golangci-lint run && \
Expand Down
2 changes: 1 addition & 1 deletion hack/dockerfiles/vendor.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile-upstream:master

FROM golang:1.18-alpine AS vendored
FROM golang:1.19-alpine AS vendored
RUN apk add --no-cache git
WORKDIR /src
RUN --mount=target=/src,rw \
Expand Down
8 changes: 4 additions & 4 deletions solver/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ func (e *edge) skipPhase2FastCache(dep *dep) bool {
// previous calls.
// To avoid deadlocks and resource leaks this function needs to follow
// following rules:
// 1) this function needs to return unclosed outgoing requests if some incoming
// requests were not completed
// 2) this function may not return outgoing requests if it has completed all
// incoming requests
// 1. this function needs to return unclosed outgoing requests if some incoming
// requests were not completed
// 2. this function may not return outgoing requests if it has completed all
// incoming requests
func (e *edge) unpark(incoming []pipe.Sender, updates, allPipes []pipe.Receiver, f *pipeFactory) {
// process all incoming changes
depChanged := false
Expand Down
1 change: 1 addition & 0 deletions solver/errdefs/errdefs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions solver/pb/ops.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion util/archutil/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ FROM base AS exit-mips64
COPY fixtures/exit.mips64.s .
RUN mips64-linux-gnuabi64-as --noexecstack -o exit.o exit.mips64.s && mips64-linux-gnuabi64-ld -o exit -s exit.o

FROM golang:1.18-alpine AS generate
FROM golang:1.19-alpine AS generate
WORKDIR /src
COPY --from=exit-amd64 /src/exit amd64
COPY --from=exit-386 /src/exit 386
Expand Down
6 changes: 3 additions & 3 deletions util/archutil/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ func SupportedPlatforms(noCache bool) []ocispecs.Platform {
return arr
}

//WarnIfUnsupported validates the platforms and show warning message if there is,
//the end user could fix the issue based on those warning, and thus no need to drop
//the platform from the candidates.
// WarnIfUnsupported validates the platforms and show warning message if there is,
// the end user could fix the issue based on those warning, and thus no need to drop
// the platform from the candidates.
func WarnIfUnsupported(pfs []ocispecs.Platform) {
def := nativePlatform()
for _, p := range pfs {
Expand Down
4 changes: 2 additions & 2 deletions util/gitutil/git_ref.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
// GitRef represents a git ref.
//
// Examples:
// - "https://github.com/foo/bar.git#baz/qux:quux/quuz" is parsed into:
// {Remote: "https://github.com/foo/bar.git", ShortName: "bar", Commit:"baz/qux", SubDir: "quux/quuz"}.
// - "https://github.com/foo/bar.git#baz/qux:quux/quuz" is parsed into:
// {Remote: "https://github.com/foo/bar.git", ShortName: "bar", Commit:"baz/qux", SubDir: "quux/quuz"}.
type GitRef struct {
// Remote is the remote repository path.
Remote string
Expand Down

0 comments on commit c07a656

Please sign in to comment.