From 8c8f58f533260d788dc2f22f2a28eea602c9e4c0 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 12 Jul 2024 18:12:56 +0200 Subject: [PATCH] Fix Go 1.22 build, adapt to modules in KST repo Resolves https://github.com/kaitai-io/kaitai_struct/issues/1083 Depends on https://github.com/kaitai-io/kaitai_struct_tests/commit/3749caca7308cf585b976ebca0da10a394f4ddc7 --- src/go/1.21-linux-x86_64/Dockerfile | 5 ++++- src/go/1.22-linux-x86_64/Dockerfile | 5 ++++- src/go/_common/prepare | 14 +++++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/go/1.21-linux-x86_64/Dockerfile b/src/go/1.21-linux-x86_64/Dockerfile index c97cdb6..e2f0aec 100644 --- a/src/go/1.21-linux-x86_64/Dockerfile +++ b/src/go/1.21-linux-x86_64/Dockerfile @@ -8,7 +8,7 @@ RUN ./prepare-alpine-init # Ruby is required for test infrastructure (aggregators, test result converters) to work RUN ./prepare-alpine-ruby -# Required to download go-junit-report release in ./prepare-go-deps +# Required to download go-junit-report release in ./prepare RUN apk add curl # Required for `go get` to work @@ -25,3 +25,6 @@ RUN ./prepare # go version go1.21.3 linux/amd64 RUN ./validate '^go version go1\.21\.' + +# Prevent Go from accessing the network (see https://go.dev/ref/mod#resolve-pkg-mod) +ENV GOPROXY=off diff --git a/src/go/1.22-linux-x86_64/Dockerfile b/src/go/1.22-linux-x86_64/Dockerfile index e292958..454ee7f 100644 --- a/src/go/1.22-linux-x86_64/Dockerfile +++ b/src/go/1.22-linux-x86_64/Dockerfile @@ -8,7 +8,7 @@ RUN ./prepare-alpine-init # Ruby is required for test infrastructure (aggregators, test result converters) to work RUN ./prepare-alpine-ruby -# Required to download go-junit-report release in ./prepare-go-deps +# Required to download go-junit-report release in ./prepare RUN apk add curl # Required for `go get` to work @@ -25,3 +25,6 @@ RUN ./prepare # go version go1.22.0 linux/amd64 RUN ./validate '^go version go1\.22\.' + +# Prevent Go from accessing the network (see https://go.dev/ref/mod#resolve-pkg-mod) +ENV GOPROXY=off diff --git a/src/go/_common/prepare b/src/go/_common/prepare index 5bc0e33..9d7b675 100755 --- a/src/go/_common/prepare +++ b/src/go/_common/prepare @@ -1,8 +1,16 @@ #!/bin/sh -ef -GO111MODULE=off go get -v github.com/kaitai-io/kaitai_struct_go_runtime/kaitai -GO111MODULE=off go get -v github.com/stretchr/testify/assert -GO111MODULE=off go get -v golang.org/x/text +( +git clone --depth 1 https://github.com/kaitai-io/kaitai_struct_go_runtime /download/runtime/go +git -C /download/runtime/go rev-parse HEAD +git clone --depth 1 https://github.com/kaitai-io/kaitai_struct_tests /download/tests +cd /download/tests +git rev-parse HEAD +./prepare-go +cd spec/go +go mod download +) +rm -rf /download # Install https://github.com/jstemmer/go-junit-report curl -fsSL https://github.com/jstemmer/go-junit-report/releases/download/v2.1.0/go-junit-report-v2.1.0-linux-amd64.tar.gz | tar xzvf -