-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: the results of "go test" and "go test -c" are not the same #45626
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
Comments
can you check if this still happens on master? |
➜ internal gotip version
go version devel go1.17-a72622d Mon Apr 19 04:37:32 2021 +0000 darwin/amd64
➜ internal gotip test
PASS
ok test3/internal 0.391s
➜ internal gotip test -c
➜ internal ./internal.test
--- FAIL: TestMessageToMap (0.00s)
message_json_test.go:105: failed,
have:map[bool_val:1 float32_val:5.5 float64_val:6.5 int32_val:1 int64_val:2 message_val:{"string_val":"sub_str", "message_val":{"string_val":"sub_sub_str"}} string_val:str uint32_val:3 uint64_val:4],
want:map[bool_val:1 float32_val:5.5 float64_val:6.5 int32_val:1 int64_val:2 message_val:{"string_val":"sub_str","message_val":{"string_val":"sub_sub_str"}} string_val:str uint32_val:3 uint64_val:4]
--- FAIL: TestMarshalJSON (0.00s)
message_json_test.go:206: failed,
have:{"bool_val":"1","float32_val":"5.5","float64_val":"6.5","int32_val":"1","int64_val":"2","message_val":"{\"string_val\":\"sub_str\", \"message_val\":{\"string_val\":\"sub_sub_str\"}}","string_val":"str","uint32_val":"3","uint64_val":"4"},
want:{"bool_val":"1","float32_val":"5.5","float64_val":"6.5","int32_val":"1","int64_val":"2","message_val":"{\"string_val\":\"sub_str\",\"message_val\":{\"string_val\":\"sub_sub_str\"}}","string_val":"str","uint32_val":"3","uint64_val":"4"}
--- FAIL: TestUnmarshalJSON (0.00s)
message_json_test.go:222: nil proto.Message
message_json_test.go:234: nil *internal.Message
message_json_test.go:246: json: cannot unmarshal string "\"True\"" into Go value of type bool
message_json_test.go:258: invalid character 'a' after object key:value pair
message_json_test.go:315: json: cannot unmarshal string "\"fuck\"" into Go value of type int32
message_json_test.go:327: json: cannot unmarshal string "\"2147483648\"" into Go value of type int32
message_json_test.go:339: json: cannot unmarshal string "\"fuck\"" into Go value of type int64
message_json_test.go:351: json: cannot unmarshal string "\"9223372036854775808\"" into Go value of type int64
message_json_test.go:363: json: cannot unmarshal string "\"fuck\"" into Go value of type uint32
message_json_test.go:375: json: cannot unmarshal string "\"4294967296\"" into Go value of type uint32
message_json_test.go:387: json: cannot unmarshal string "\"fuck\"" into Go value of type uint64
message_json_test.go:399: json: cannot unmarshal string "\"18446744073709551616\"" into Go value of type uint64
message_json_test.go:411: json: cannot unmarshal string "\"fuck\"" into Go value of type float32
message_json_test.go:423: json: cannot unmarshal string "\"3.4028234663852886e+39\"" into Go value of type float32
message_json_test.go:435: json: cannot unmarshal string "\"fuck\"" into Go value of type float64
message_json_test.go:447: json: cannot unmarshal string "\"1.7976931348623157e+309\"" into Go value of type float64
message_json_test.go:459: json: cannot unmarshal string "\"fuck\"" into Go value of type *internal.SubMessage
message_json_test.go:693: failed,
have:{"bool_val":"1","float32_val":"3.4028234663852886e+38","float64_val":"1.7976931348623157e+308","int32_val":"2147483647","int64_val":"9223372036854775807","message_val":"{\"string_val\":\"sub_str\", \"message_val\":{\"string_val\":\"sub_sub_str\"}}","string_val":"str","uint32_val":"4294967295","uint64_val":"18446744073709551615"},
want:{"bool_val":"1","float32_val":"3.4028234663852886e+38","float64_val":"1.7976931348623157e+308","int32_val":"2147483647","int64_val":"9223372036854775807","message_val":"{\"string_val\":\"sub_str\",\"message_val\":{\"string_val\":\"sub_sub_str\"}}","string_val":"str","uint32_val":"4294967295","uint64_val":"18446744073709551615"}
FAIL
➜ internal |
Sorry everyone, I found the reason, so I close this issue, thanks all. https://github.com/protocolbuffers/protobuf-go/blob/v1.26.0/internal/encoding/json/encode.go#L239 |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I wrote an internal SDK (in the attach file below), when I execute
go test
, I find it fails, this is not what I expected;When I execute
go test -c
and then execute this executable test file, it succeeds, this is what I expected.What did you expect to see?
What did you see instead?
test files
test3.tar.gz
The text was updated successfully, but these errors were encountered: