testify icon indicating copy to clipboard operation
testify copied to clipboard

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

Open lisitsky opened this issue 3 years ago • 2 comments

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

lisitsky avatar Aug 16 '22 09:08 lisitsky

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 avatar Aug 24 '22 09:08 kubaceg

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.

lisitsky avatar Aug 26 '22 18:08 lisitsky

Outdated.

dolmen avatar Oct 16 '23 17:10 dolmen