Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 1.19 to go_version matrix to run tests against latest go versions. #1252

Closed
wants to merge 19 commits into from

Conversation

lisitsky
Copy link
Contributor

@lisitsky lisitsky commented Aug 16, 2022

Summary

Test testify against actual golang version.

Changes

matrix:
        go_version: ["1.19", ...]

Motivation

To ensure testify is ready for actuality and future.

Related issues

@kubaceg
Copy link

kubaceg commented Aug 24, 2022

Did You run code gofmt on 1.19? I think it's required by go 1.19, there was some changes in comments formatting

@@ -6,13 +6,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go_version: ["1.18.1", "1.17.6", "1.16.5"]
go_version: ["^1.18", "^1.17", "^1.16"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ^ symbol is not required, the 1.18 will work as expected

@lisitsky
Copy link
Contributor Author

Did You run code gofmt on 1.19? I think it's required by go 1.19, there was some changes in comments formatting

@kubaceg Yes. The problem is correct gofmt format is different for versions 1.19 and prior 1.19
First I format code with 1.16:

❯ docker run -v $(pwd):/src --rm golang:1.16 sh -c 'cd /src; /src/.ci.gofmt.sh'
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/stretchr/objx v0.4.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607
/src/assert
/src/assert
/src/require
/src/require
Go generate output does not match commit.
Did you forget to run go generate ./... ?

commit changes:

❯ git status
On branch add-go-1.19-to-test-matrix
Your branch is up to date with 'origin/add-go-1.19-to-test-matrix'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   assert/assertion_format.go
        modified:   assert/assertion_forward.go
        modified:   require/require.go
        modified:   require/require_forward.go

❯ git add assert/ require/
❯ git commit -m "go fmt with version 1.16 go version"

Then I run .ci.gogenerate.sh with different go versions: 1.16-1.9:

❯ for i in {16..19}; do (set -o pipefail; echo $i; docker run -v $(pwd):/src --rm golang:1.$i sh -c 'cd /src;  /src/.ci.gogenerate.sh' 2>/dev/null 1|wc -l) ; echo "    error: " $?; done
16
       4
    error:  0
17
       4
    error:  0
18
       4
    error:  0
19
    3738
    error:  1

Number shows count of different lines - indeedgit diff plus package names. So 4 lines means no difference. Error shows - is there difference or not.

Than I format code with go 1.19:

❯ docker run -v $(pwd):/src --rm golang:1.19 sh -c 'cd /src; /src/.ci.gofmt.sh'
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/stretchr/objx v0.4.0
go: downloading github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607
/src/assert
/src/assert
/src/require
/src/require
Go generate output does not match commit.
Did you forget to run go generate ./... ?

❯ git add assert/ require/
❯ git commit -m "go fmt with version 1.19 go version"
[add-go-1.19-to-test-matrix e49ec0f] go fmt with version 1.19 go version
 4 files changed, 609 insertions(+), 609 deletions(-)

and check with the same versions again:

❯ for i in {16..19}; do (set -o pipefail; echo $i; docker run -v $(pwd):/src --rm golang:1.$i sh -c 'cd /src;  /src/.ci.gogenerate.sh' 2>/dev/null 1|wc -l) ; echo "    error: " $?; done
16
    3738
    error:  1
17
    3738
    error:  1
18
    3738
    error:  1
19
       4
    error:  0

So if strict format enabled there's no version suitable for <1.19 and 1.19 at the same moment.

@dolmen dolmen added github_actions Pull requests that update GitHub Actions code rejected/duplicate labels Oct 16, 2023
@dolmen
Copy link
Collaborator

dolmen commented Oct 16, 2023

Outdated.

@dolmen dolmen closed this Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github_actions Pull requests that update GitHub Actions code rejected/duplicate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants