Skip to content

Commit

Permalink
feat(go): emit deprecation warning when using go1.16 and go1.17 (#3718)
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainMuller committed Aug 22, 2022
1 parent 0cc5b11 commit 3cf5c28
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 29 deletions.
45 changes: 32 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- name: Set up Go 1.16
- name: Set up Go 1.18
uses: actions/setup-go@v3
with:
go-version: '1.16'
go-version: '1.18'
- name: Set up Java 8
uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -126,10 +126,10 @@ jobs:
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- name: Set up Go 1.16
- name: Set up Go 1.18
uses: actions/setup-go@v3
with:
go-version: '1.16'
go-version: '1.18'
- name: Set up Java 8
uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -207,14 +207,14 @@ jobs:
test:
permissions:
contents: none
name: Test (${{ matrix.os }} / dotnet ${{ matrix.dotnet }} / java ${{ matrix.java }} / node ${{ matrix.node }} / python ${{ matrix.python }})
name: Test (${{ matrix.os }} / dotnet ${{ matrix.dotnet }} / go ${{ matrix.go }} / java ${{ matrix.java }} / node ${{ matrix.node }} / python ${{ matrix.python }})
needs: build
strategy:
fail-fast: false
matrix:
# All currently supported node versions (Maintenance LTS, Active LTS, Current)
dotnet: ['3.1.x']
go: ['1.16']
go: ['1.18']
java: ['8']
node:
- '14' # EOL 2023-04-30
Expand All @@ -227,47 +227,66 @@ jobs:
# Test using Windows
- os: windows-latest
dotnet: '3.1.x'
go: '1.16'
go: '1.18'
java: '8'
node: '14'
python: '3.7'
# Test using macOS
- os: macos-latest
dotnet: '3.1.x'
go: '1.16'
go: '1.18'
java: '8'
node: '14'
python: '3.7'
# Test alternate .NETs
- java: '8'
dotnet: '6.0.x'
go: '1.16'
go: '1.18'
node: '14'
os: ubuntu-latest
python: '3.7'
# Test alternate Gos
- java: '8'
dotnet: '3.1.x'
go: '1.16' # EOL since March 15, 2022 (in grace period until end of september 2022)
node: '14'
os: ubuntu-latest
python: '3.7'
- java: '8'
dotnet: '3.1.x'
go: '1.17' # EOL since August 02, 2022 (in grace period until end of september 2022)
node: '14'
os: ubuntu-latest
python: '3.7'
- java: '8'
dotnet: '3.1.x'
go: '1.19'
node: '14'
os: ubuntu-latest
python: '3.7'
# Test alternate Javas
- java: '11'
dotnet: '3.1.x'
go: '1.16'
go: '1.18'
node: '14'
os: ubuntu-latest
python: '3.7'
# Test alternate Pythons
- python: '3.8'
dotnet: '3.1.x'
go: '1.16'
go: '1.18'
java: '8'
node: '14'
os: ubuntu-latest
- python: '3.9'
dotnet: '3.1.x'
go: '1.16'
go: '1.18'
java: '8'
node: '14'
os: ubuntu-latest
- python: '3.10'
dotnet: '3.1.x'
go: '1.16'
go: '1.18'
java: '8'
node: '14'
os: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion gh-pages/content/user-guides/lib-author/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ to produce releasable artifacts.
| Language/Platform | SDK Requirement |
| ----------------- | ---------------------------- |
| .NET | .NET Core ≥ 3.1 / .NET ≥ 5.0 |
| Go | Go ≥ 1.16 |
| Go | Go ≥ 1.18 |
| Java | JDK ≥ 8 *and* Maven ≥ 3.6 |
| Python | Python ≥ 3.7 |

Expand Down
12 changes: 1 addition & 11 deletions packages/@jsii/go-runtime-test/project/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/aws/jsii/go-runtime-test

go 1.17
go 1.16

require (
github.com/aws/jsii-runtime-go v0.0.0
Expand All @@ -12,16 +12,6 @@ require (
golang.org/x/tools v0.1.12
)

require (
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/aws/jsii/jsii-calc/go/scopejsiicalcbaseofbase/v2 v2.1.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace (
github.com/aws/jsii-runtime-go => ../../go-runtime/jsii-runtime-go
github.com/aws/jsii/jsii-calc/go/jcb => ../jsii-calc/go/jcb
Expand Down
5 changes: 4 additions & 1 deletion packages/@jsii/go-runtime-test/project/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down Expand Up @@ -30,8 +32,9 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
37 changes: 37 additions & 0 deletions packages/@jsii/go-runtime/jsii-runtime-go/deprecationwarning.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//go:build (go1.16 || go1.17) && !go1.18
// +build go1.16 go1.17
// +build !go1.18

package jsii

import (
"fmt"
"os"

"github.com/aws/jsii-runtime-go/internal/compiler"
"github.com/mattn/go-isatty"
)

// / Emits a deprecation warning message when
func init() {
tty := isatty.IsTerminal(os.Stderr.Fd()) || isatty.IsCygwinTerminal(os.Stderr.Fd())

if tty {
// Set terminal to bold red
fmt.Fprintf(os.Stderr, "\u001b[31m\u001b[1m")
}

fmt.Fprintln(os.Stderr, "###########################################################")
fmt.Fprintf(os.Stderr, "# This binary was compiled with %v, which has reached #\n", compiler.Version)
fmt.Fprintf(os.Stderr, "# end-of-life on %v. #\n", compiler.EndOfLifeDate)
fmt.Fprintln(os.Stderr, "# #")
fmt.Fprintln(os.Stderr, "# Support for this version WILL be dropped in the future! #")
fmt.Fprintln(os.Stderr, "# #")
fmt.Fprintln(os.Stderr, "# See https://go.dev/security for more information. #")
fmt.Fprintln(os.Stderr, "###########################################################")

if tty {
// Reset terminal back to normal
fmt.Fprintf(os.Stderr, "\u001b[0m")
}
}
1 change: 1 addition & 0 deletions packages/@jsii/go-runtime/jsii-runtime-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.16

require (
github.com/Masterminds/semver/v3 v3.1.1
github.com/mattn/go-isatty v0.0.16
github.com/stretchr/testify v1.8.0
)

Expand Down
4 changes: 4 additions & 0 deletions packages/@jsii/go-runtime/jsii-runtime-go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//go:build go1.16 && !go1.17
// +build go1.16,!go1.17

package compiler

// Version denotes the version of the go compiler that was used for building
// this binary. It is intended for use only in the compiler deprecation warning
// message.
const Version = "go1.16"

// EndOfLifeDate is the date at which this compiler version reached end-of-life.
const EndOfLifeDate = "2022-03-15"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//go:build go1.17 && !go1.18
// +build go1.17,!go1.18

package compiler

// Version denotes the version of the go compiler that was used for building
// this binary. It is intended for use only in the compiler deprecation warning
// message.
const Version = "go1.17"

// EndOfLifeDate is the date at which this compiler version reached end-of-life.
const EndOfLifeDate = "2022-08-02"
2 changes: 1 addition & 1 deletion packages/jsii-pacmak/lib/targets/go.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Golang extends Target {
const localGoMod = await this.writeLocalGoMod(pkgDir);

try {
// run `go build` with local.go.mod, go 1.16 requires that we download
// run `go build` with local.go.mod, go 1.16+ requires that we download
// modules explicit so go.sum is updated. We'd normally want to use
// `go mod download`, but because of a bug in go 1.16, we have to use
// `go mod tidy` instead.
Expand Down
2 changes: 1 addition & 1 deletion superchain/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ RUN POWERSHELL_RELEASE=$(curl -X GET -fSsIL "https://aka.ms/powershell-release?t
&& chmod +x /opt/microsoft/powershell/pwsh

# Prepare Go distribution
ARG GO_VERSION="1.17.5"
ARG GO_VERSION="1.18.5"
RUN curl -fSsL "https://golang.org/dl/go${GO_VERSION}.linux-${TARGETPLATFORM#linux/}.tar.gz" -o /tmp/go.tar.gz \
&& mkdir -p /opt/golang/go \
&& tar -xzf /tmp/go.tar.gz -C /opt/golang/go --strip-components=1
Expand Down
2 changes: 1 addition & 1 deletion superchain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ SDK | Version
`Javascript` | see [NodeJS and NPM](#nodejs-and-npm)
`PowerShell` | `pwsh >= 7.1.3`
`Python 3` | `python3 >= 3.7.4` with `pip3 >= 20.0.2`
`Go` | `go >= 1.17`
`Go` | `go >= 1.18`

## Image tags

Expand Down

0 comments on commit 3cf5c28

Please sign in to comment.