Skip to content

tests broken in go1.7 #356

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

Closed
cybrcodr opened this issue May 22, 2017 · 5 comments
Closed

tests broken in go1.7 #356

cybrcodr opened this issue May 22, 2017 · 5 comments
Assignees

Comments

@cybrcodr
Copy link
Contributor

$ go version
go version go1.7.5 darwin/amd64
$ go test github.com/golang/protobuf/...

# testmain
/var/folders/00/0nq68000h01000cxqpysvccm002pws/T/go-build398341187/github.com/golang/protobuf/ptypes/_test/_testmain.go:74: cannot use matchString (type func(string, string) (bool, error)) as type testing.testDeps in argument to testing.MainStart:
        func(string, string) (bool, error) does not implement testing.testDeps (missing MatchString method)
# testmain
/var/folders/00/0nq68000h01000cxqpysvccm002pws/T/go-build398341187/github.com/golang/protobuf/descriptor/_test/_testmain.go:56: cannot use matchString (type func(string, string) (bool, error)) as type testing.testDeps in argument to testing.MainStart:
        func(string, string) (bool, error) does not implement testing.testDeps (missing MatchString method)
FAIL    github.com/golang/protobuf/descriptor [build failed]
# testmain
/var/folders/00/0nq68000h01000cxqpysvccm002pws/T/go-build398341187/github.com/golang/protobuf/jsonpb/_test/_testmain.go:58: cannot use matchString (type func(string, string) (bool, error)) as type testing.testDeps in argument to testing.MainStart:
        func(string, string) (bool, error) does not implement testing.testDeps (missing MatchString method)
FAIL    github.com/golang/protobuf/jsonpb [build failed]
?       github.com/golang/protobuf/jsonpb/jsonpb_test_proto     [no test files]
# testmain
/var/folders/00/0nq68000h01000cxqpysvccm002pws/T/go-build398341187/github.com/golang/protobuf/protoc-gen-go/generator/_test/_testmain.go:54: cannot use matchString (type func(string, string) (bool, error)) as type testing.testDeps in argument to testing.MainStart:
        func(string, string) (bool, error) does not implement testing.testDeps (missing MatchString method)
# testmain
/var/folders/00/0nq68000h01000cxqpysvccm002pws/T/go-build398341187/github.com/golang/protobuf/proto/_test/_testmain.go:294: cannot use matchString (type func(string, string) (bool, error)) as type testing.testDeps in argument to testing.MainStart:
        func(string, string) (bool, error) does not implement testing.testDeps (missing MatchString method)

Same issue with go1.6. As discussed, we'd like to be able to support at least latest 1.6 for now.

@bradfitz
Copy link

I think your environment is screwed up.

I get:

$ cat `which go`
#!/bin/sh

exec $GOROOT/bin/go "$@"


$ GOROOT=$HOME/go1.8 go test github.com/golang/protobuf/...
ok      github.com/golang/protobuf/descriptor   0.012s
ok      github.com/golang/protobuf/jsonpb       0.013s
?       github.com/golang/protobuf/jsonpb/jsonpb_test_proto     [no test files]
ok      github.com/golang/protobuf/proto        0.035s
?       github.com/golang/protobuf/proto/proto3_proto   [no test files]
?       github.com/golang/protobuf/protoc-gen-go        [no test files]
?       github.com/golang/protobuf/protoc-gen-go/descriptor     [no test files]
ok      github.com/golang/protobuf/protoc-gen-go/generator      0.003s
?       github.com/golang/protobuf/protoc-gen-go/grpc   [no test files]
?       github.com/golang/protobuf/protoc-gen-go/plugin [no test files]
ok      github.com/golang/protobuf/ptypes       0.028s
?       github.com/golang/protobuf/ptypes/any   [no test files]
?       github.com/golang/protobuf/ptypes/duration      [no test files]
?       github.com/golang/protobuf/ptypes/empty [no test files]
?       github.com/golang/protobuf/ptypes/struct        [no test files]
?       github.com/golang/protobuf/ptypes/timestamp     [no test files]
?       github.com/golang/protobuf/ptypes/wrappers      [no test files]


$ GOROOT=$HOME/go1.7 go test github.com/golang/protobuf/...
ok      github.com/golang/protobuf/descriptor   0.013s
--- FAIL: TestUnmarshaling (0.00s)
        jsonpb_test.go:570: Any with message: can't unmarshal nested Any proto: json: cannot unmarshal string into Go value of type bool
        jsonpb_test.go:570: Any with message and indent: can't unmarshal nested Any proto: json: cannot unmarshal string into Go value of type bool
FAIL
FAIL    github.com/golang/protobuf/jsonpb       0.009s
?       github.com/golang/protobuf/jsonpb/jsonpb_test_proto     [no test files]
ok      github.com/golang/protobuf/proto        0.038s
?       github.com/golang/protobuf/proto/proto3_proto   [no test files]
?       github.com/golang/protobuf/protoc-gen-go        [no test files]
?       github.com/golang/protobuf/protoc-gen-go/descriptor     [no test files]
ok      github.com/golang/protobuf/protoc-gen-go/generator      0.013s
?       github.com/golang/protobuf/protoc-gen-go/grpc   [no test files]
?       github.com/golang/protobuf/protoc-gen-go/plugin [no test files]
ok      github.com/golang/protobuf/ptypes       0.015s
?       github.com/golang/protobuf/ptypes/any   [no test files]
?       github.com/golang/protobuf/ptypes/duration      [no test files]
?       github.com/golang/protobuf/ptypes/empty [no test files]
?       github.com/golang/protobuf/ptypes/struct        [no test files]
?       github.com/golang/protobuf/ptypes/timestamp     [no test files]
?       github.com/golang/protobuf/ptypes/wrappers      [no test files]


$ GOROOT=$HOME/go1.6 go test github.com/golang/protobuf/...
ok      github.com/golang/protobuf/descriptor   0.005s
# github.com/golang/protobuf/proto_test
proto/decode_test.go:58: b.Run undefined (type *testing.B has no field or method Run, but does have testing.run)
proto/decode_test.go:83: b.Run undefined (type *testing.B has no field or method Run, but does have testing.run)
proto/decode_test.go:108: b.Run undefined (type *testing.B has no field or method Run, but does have testing.run)
proto/decode_test.go:133: b.Run undefined (type *testing.B has no field or method Run, but does have testing.run)
proto/decode_test.go:164: b.Run undefined (type *testing.B has no field or method Run, but does have testing.run)
proto/encode_test.go:53: b.Run undefined (type *testing.B has no field or method Run, but does have testing.run)
--- FAIL: TestUnmarshaling (0.00s)
        jsonpb_test.go:570: Any with message: can't unmarshal nested Any proto: json: cannot unmarshal string into Go value of type bool
        jsonpb_test.go:570: Any with message and indent: can't unmarshal nested Any proto: json: cannot unmarshal string into Go value of type bool
FAIL
FAIL    github.com/golang/protobuf/jsonpb       0.010s
?       github.com/golang/protobuf/jsonpb/jsonpb_test_proto     [no test files]
FAIL    github.com/golang/protobuf/proto [build failed]
?       github.com/golang/protobuf/proto/proto3_proto   [no test files]
?       github.com/golang/protobuf/protoc-gen-go        [no test files]
?       github.com/golang/protobuf/protoc-gen-go/descriptor     [no test files]
ok      github.com/golang/protobuf/protoc-gen-go/generator      0.014s
?       github.com/golang/protobuf/protoc-gen-go/grpc   [no test files]
?       github.com/golang/protobuf/protoc-gen-go/plugin [no test files]
ok      github.com/golang/protobuf/ptypes       0.004s
?       github.com/golang/protobuf/ptypes/any   [no test files]
?       github.com/golang/protobuf/ptypes/duration      [no test files]
?       github.com/golang/protobuf/ptypes/empty [no test files]
?       github.com/golang/protobuf/ptypes/struct        [no test files]
?       github.com/golang/protobuf/ptypes/timestamp     [no test files]
?       github.com/golang/protobuf/ptypes/wrappers      [no test files]

@cybrcodr
Copy link
Contributor Author

Ah, thanks. I missed out setting GOROOT. I thought I didn't have to do that anymore.

@bradfitz
Copy link

You don't need to set GOROOT if the binaries you're running have the correct GOROOT baked in. I use GOROOT because my 'go' wrapper script (shown above) also uses it to find the real go binary. Others have different setups.

I don't know your setup, but something's wrong.

@cybrcodr
Copy link
Contributor Author

Chatted with @bradfitz, GOROOT is typically baked in as /usr/local/go if running go from /usr/local/go/bin. I have different installations at ~/goX.Y to allow for testing different versions hence I needed to explicitly set GOROOT whenever I switch to use those. I've now set up aliases instead for specific versions.

Anyways, the issue still holds, but with different errors instead, refer to second post to see the actual errors.

@cybrcodr cybrcodr assigned cybrcodr and unassigned dsnet May 25, 2017
dsnet pushed a commit that referenced this issue May 26, 2017
Disable benchmarks using testing.B.Run for pre-go1.7.

Fix unmarshaling Any for pre-1.8.  Unmarshaling code for Any assumed
json.RawMessage value receiver on json.Marshaler interface, but it was a
pointer receiver pre-1.8.
@cybrcodr
Copy link
Contributor Author

Fixed in 63bfc70

@golang golang locked and limited conversation to collaborators Jun 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants