main,bind,_examples: fix tests for go 1.16

* main,bind,_examples: fix tests for go 1.16

This CL fixes a number of tests that are failing under go 1.16.
Modules behave a bit differently, the //comment directives now
need a space, generated version file needs go fmt, and there was a
mis-named symbol

* ci: Update travis and appveyor for recent Go and fix pypy download links

* ci: fix typo in travis script, and adjust go to max appveyor version

* ci: update appveyor PATH to pick up proper latest go version

* fix: Re-enable test cleanup

* ci: update appveyor to pin GOROOT

* ci: update appveyor to use latest windows image
This commit is contained in:
Justin Israel 2021-03-17 00:51:57 +13:00 committed by GitHub
parent 8bcdf6b9cb
commit 7bd7360fdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 36 additions and 18 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# IDE files
.idea/
*.iml

View File

@ -1,9 +1,8 @@
language: go
go:
- 1.13.x
- 1.12.x
- 1.11.x
- 1.16.x
- 1.15.x
- master
cache:
@ -31,8 +30,8 @@ before_install:
# pypy3 isn't packaged in ubuntu yet.
- TEMPDIR=$(mktemp -d)
- export PYPYVERSION=v7.1.1
- curl -L https://bitbucket.org/pypy/pypy/downloads/pypy2.7-${PYPYVERSION}-linux64.tar.bz2 --output $TEMPDIR/pypy2.tar.bz2
- curl -L https://bitbucket.org/pypy/pypy/downloads/pypy3.6-${PYPYVERSION}-linux64.tar.bz2 --output $TEMPDIR/pypy3.tar.bz2
- curl -L https://downloads.python.org/pypy/pypy2.7-${PYPYVERSION}-linux64.tar.bz2 --output $TEMPDIR/pypy2.tar.bz2
- curl -L https://downloads.python.org/pypy/pypy3.6-${PYPYVERSION}-linux64.tar.bz2 --output $TEMPDIR/pypy3.tar.bz2
- tar xf $TEMPDIR/pypy2.tar.bz2 -C $TEMPDIR
- tar xf $TEMPDIR/pypy3.tar.bz2 -C $TEMPDIR
- sudo ln -s $TEMPDIR/pypy2.7-$PYPYVERSION-linux64/bin/pypy /usr/local/bin/pypy

View File

@ -36,7 +36,7 @@ func IfaceString(str interface{}) {
cpkg.Printf("iface as string: %v\n", str)
}
//gopy:interface=handle
// gopy:interface=handle
// this magic directive says, treat the interface arg as a handle
func IfaceHandle(ifc interface{}) {
cpkg.Printf("iface as handle: %v\n", ifc)

View File

@ -5,7 +5,7 @@
// package rename tests changing the names of methods and functions
package rename
//gopy:name say_hi
// gopy:name say_hi
func SayHi() string {
return "hi"
}
@ -13,7 +13,7 @@ func SayHi() string {
type MyStruct struct {
}
//gopy:name say_something
// gopy:name say_something
func (s *MyStruct) SaySomething() (something string) {
return "something"
}

View File

@ -1,3 +1,5 @@
image: Previous Visual Studio 2019
build: off
clone_folder: c:\gopath\src\github.com\go-python\gopy
@ -11,15 +13,16 @@ branches:
- master
environment:
GOPATH: c:\gopath
GOPATH: C:\gopath
GOROOT: C:\go115
GOPY_APPVEYOR_CI: '1'
GOTRACEBACK: 'crash'
#CPYTHON2DIR: "C:\\Python27-x64"
CPYTHON3DIR: "C:\\Python37-x64"
#PATH: '%GOPATH%\bin;%CPYTHON2DIR%;%CPYTHON2DIR%\\Scripts;%CPYTHON3DIR%;%CPYTHON3DIR%\\Scripts;C:\msys64\mingw64\bin;C:\msys64\usr\bin\;%PATH%'
PATH: '%GOPATH%\bin;%CPYTHON3DIR%;%CPYTHON3DIR%\\Scripts;C:\msys64\mingw64\bin;C:\msys64\usr\bin\;%PATH%'
PATH: '%GOPATH%\bin;%GOROOT%\bin;%CPYTHON3DIR%;%CPYTHON3DIR%\\Scripts;C:\msys64\mingw64\bin;C:\msys64\usr\bin\;%PATH%'
stack: go 1.13
stack: go 1.15
build_script:
- python --version
@ -31,6 +34,8 @@ build_script:
- "%CPYTHON3DIR%\\python -m pip install cffi"
#- "%CPYTHON2DIR%\\python -m pip install pybindgen"
- "%CPYTHON3DIR%\\python -m pip install pybindgen"
- go version
- go env
- go get -v -t ./...
test_script:

View File

@ -75,7 +75,7 @@ func TestPythonConfig(t *testing.T) {
for _, tc := range []struct {
vm string
want pyconfig
want PyConfig
}{
{
vm: "python2",

2
go.mod
View File

@ -6,5 +6,5 @@ require (
github.com/gonuts/commander v0.1.0
github.com/gonuts/flag v0.1.0
github.com/pkg/errors v0.9.1
golang.org/x/tools v0.0.0-20201123232213-4aa1a224cdb5
golang.org/x/tools v0.1.0
)

11
go.sum
View File

@ -4,26 +4,33 @@ github.com/gonuts/flag v0.1.0 h1:fqMv/MZ+oNGu0i9gp0/IQ/ZaPIDoAZBOBaJoV7viCWM=
github.com/gonuts/flag v0.1.0/go.mod h1:ZTmTGtrSPejTo/SRNhCqwLTmiAgyBdCkLYhHrAoBdz4=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/yuin/goldmark v1.2.1 h1:ruQGxdhGHe7FWOJPT0mKs5+pD2Xs1Bm/kdGlHO04FmM=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201123232213-4aa1a224cdb5 h1:ylHD4UIwP+CofOZHT/selc5MjXJ3yZnEg2OfYkLaPXs=
golang.org/x/tools v0.0.0-20201123232213-4aa1a224cdb5/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=

View File

@ -52,6 +52,11 @@ var (
testEnvironment = os.Environ()
)
func init() {
os.Setenv("GOFLAGS", "-mod=mod")
testEnvironment = append(testEnvironment, "GOFLAGS=-mod=mod")
}
func TestGovet(t *testing.T) {
cmd := exec.Command("go", "vet", "./...")
buf := new(bytes.Buffer)

View File

@ -3,8 +3,7 @@
package main
const (
Version = "v0.3.4"
GitCommit = "0d0bcab" // the commit JUST BEFORE the release
Version = "v0.3.4"
GitCommit = "0d0bcab" // the commit JUST BEFORE the release
VersionDate = "2020-11-24 02:36" // UTC
)