Skip to content

Commit

Permalink
Merge pull request #71 from goretk/update/add-go-1-21
Browse files Browse the repository at this point in the history
Add new compiler versions
  • Loading branch information
TcM1911 authored Nov 10, 2023
2 parents 8de0e40 + 705ec7a commit 1ce21cf
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Go",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/go:0-1.20"
"image": "mcr.microsoft.com/devcontainers/go:1.21-bullseye"

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ">=1.20.0"
go-version: ">=1.21.0"

- name: Build
run: go build -o a
Expand Down
14 changes: 12 additions & 2 deletions file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"testing"

Expand Down Expand Up @@ -76,6 +77,13 @@ func TestGoldFiles(t *testing.T) {
t.Skip("No golden files")
}

mustParse := func(n int, e error) int {
if err != nil {
t.Fatalf("parsing error: %s", err)
}
return n
}

for _, file := range goldFiles {
t.Run("compiler_version_"+file, func(t *testing.T) {
assert := assert.New(t)
Expand All @@ -96,10 +104,12 @@ func TestGoldFiles(t *testing.T) {
// Get info from filename gold-os-arch-goversion
fileInfo := strings.Split(file, "-")

// If patch level is 0, it is dropped. For example. 10.0.0 is 10.0
// If patch level is 0, it is dropped. For example. 10.0.0 is 10.0.
// This was changed in 1.21 so if the version is 1.21 or greater, we take
// the whole string.
var actualVersion string
verArr := strings.Split(fileInfo[3], ".")
if len(verArr) == 3 && verArr[2] == "0" {
if len(verArr) == 3 && verArr[2] == "0" && mustParse(strconv.Atoi(verArr[1])) < 21 {
actualVersion = strings.Join(verArr[:2], ".")
} else {
actualVersion = fileInfo[3]
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module github.com/goretk/gore

go 1.20
go 1.21

require (
github.com/stretchr/testify v1.7.1
golang.org/x/arch v0.0.0-20220412001346-fc48f9fe4c15
golang.org/x/mod v0.5.1
github.com/stretchr/testify v1.8.4
golang.org/x/arch v0.6.0
golang.org/x/mod v0.14.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20220512140231-539c8e751b99 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
19 changes: 8 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
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/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/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/arch v0.0.0-20220412001346-fc48f9fe4c15 h1:GVfVkciLYxn5mY5EncwAe0SXUn9Rm81rRkZ0TTmn/cU=
golang.org/x/arch v0.0.0-20220412001346-fc48f9fe4c15/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/arch v0.6.0 h1:S0JTfE48HbRj80+4tbvZDYsJ3tGv6BUU3XxyZ7CirAc=
golang.org/x/arch v0.6.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
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=
gopkg.in/yaml.v3 v3.0.0-20220512140231-539c8e751b99 h1:dbuHpmKjkDzSOMKAWl10QNlgaZUd3V1q99xc81tt2Kc=
gopkg.in/yaml.v3 v3.0.0-20220512140231-539c8e751b99/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
24 changes: 23 additions & 1 deletion goversion_gen.go

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

22 changes: 22 additions & 0 deletions resources/goversions.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
version,sha,date
go1.21.4,ed817f1c4055a559a94afffecbb91c78e4f39942,2023-11-07T17:38:04Z
go1.21.3,883f062fc0a097bf561030ad453fd3e300896975,2023-10-10T16:31:03Z
go1.21.2,26b5783b72376acd0386f78295e678b9a6bff30e,2023-10-05T19:06:58Z
go1.21.1,2c1e5b05fe39fc5e6c730dd60e82946b8e67c6ba,2023-09-06T15:31:51Z
go1.21.0,c19c4c566c63818dfd059b352e52c4710eecf14d,2023-08-08T15:00:52Z
go1.21rc4,041dd5ce051caf72d64b6d5f2f975515b3676a71,2023-08-02T13:51:49Z
go1.21rc3,4aeac326b5cb41a24d6e48c01008abf2f0fda7ff,2023-07-14T15:07:26Z
go1.21rc2,d8117459c513e048eb72f11988d5416110dff359,2023-06-21T15:40:05Z
go1.21rc1,1c1c82432a78b06c8010c7257df58ff11cc05b61,2023-06-16T14:21:46Z
go1.20.11,1d0d4b149ce71083ec474d0491851ab2d2dc695e,2023-11-07T17:55:05Z
go1.20.10,8042fd87f37a725e34407994c9a11aaf95f5af45,2023-10-10T16:26:21Z
go1.20.9,68f9a6e2addc828246992e66e79c6a51a32d1d71,2023-10-05T19:28:06Z
go1.20.8,d5b851804329aa547dafa278a0c35dd62298d651,2023-09-06T15:31:47Z
go1.20.7,adb775e309dea43157e931835e920ac9e7769abe,2023-08-01T19:34:15Z
go1.20.6,2c358ffe9762ba08c8db0196942395f97775e31b,2023-07-11T15:58:20Z
go1.20.5,e827d41c0a2ea392c117a790cdfed0022e419424,2023-06-06T17:39:34Z
go1.20.4,324c3ace2d2e4e30949baa23b4c9aac8a4123317,2023-05-02T17:21:02Z
go1.20.3,7c47a6b15782b13ecb76fd3c6c18e5f1edc34733,2023-04-04T17:30:09Z
go1.20.2,aee9a19c559da6fd258a8609556d89f6fad2a6d8,2023-03-07T16:47:18Z
go1.20.1,202a1a57064127c3f19d96df57b9f9586145e21c,2023-02-14T18:12:19Z
go1.20,de4748c47c67392a57f250714509f590f68ad395,2023-02-01T19:03:46Z
go1.20rc3,b3160e8bcedb25c5266e047ada01b6f462521401,2023-01-12T17:16:08Z
go1.20rc2,32593a91927dbb891e00a5a94abb04105f6a8aa8,2023-01-04T16:02:35Z
go1.20rc1,9f0234214473dfb785a5ad84a8fc62a6a395cbc3,2022-12-07T22:00:46Z
go1.19.13,619b8fd7d2c94af12933f409e962b99aa9263555,2023-09-06T15:37:56Z
go1.19.12,0ae54ddd37302bdd2a8c775135bf5f076a18eeb3,2023-08-01T20:11:51Z
go1.19.11,e58941fc25771784319ebd0178e566ecf7d3d8c1,2023-07-11T16:38:32Z
go1.19.10,7fe60b5df764f5a16a2c40e4412b5ed60f709192,2023-06-06T17:46:04Z
go1.19.9,484330d038d060c6e4db3dc8e6ea2b811b2a44d8,2023-05-02T17:21:05Z
go1.19.8,ca305e101d89969b5cc6a812b1f12038b769aaa2,2023-04-04T17:30:16Z
go1.19.7,7bd22aafe41be40e2174335a3dc55431ca9548ec,2023-03-07T16:49:31Z
go1.19.6,8656c03fee94ce9cdc4da120b831c2fb9fd68d9d,2023-02-14T18:09:51Z
Expand Down
35 changes: 32 additions & 3 deletions stdpkg_gen.go

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

1 change: 1 addition & 0 deletions testdata/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ var spec = []struct {
{"1.18.0", []osarchTuple{{linux, []goarch{x86, amd64}}, {darwin, []goarch{arm64, amd64}}, {windows, []goarch{x86, amd64}}}},
{"1.19.0", []osarchTuple{{linux, []goarch{x86, amd64}}, {darwin, []goarch{arm64, amd64}}, {windows, []goarch{x86, amd64}}}},
{"1.20.0", []osarchTuple{{linux, []goarch{x86, amd64}}, {darwin, []goarch{arm64, amd64}}, {windows, []goarch{x86, amd64}}}},
{"1.21.0", []osarchTuple{{linux, []goarch{x86, amd64}}, {darwin, []goarch{arm64, amd64}}, {windows, []goarch{x86, amd64}}}},
}

const gofile = `package main
Expand Down

0 comments on commit 1ce21cf

Please sign in to comment.