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
net/rpc/jsonrpc: return error when reply not set #19588
Comments
This is correct. JSON-RPC says the result must be non-null on success. |
But why "Multiply" return no error? I did not set the result of "result *Result" |
Because result is not null. An *int is created with a value of 0. |
OK,thanks, I understand it. But I think it can easily be confused . |
The part that might be considered a bug is that the map is not created. I would also wonder if slices have a similar issue given how the return value is created. |
For consistency with the I'd accept a patch. |
I test slices,it have the same issue. |
CL https://golang.org/cl/38474 mentions this issue. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8 windows/amd64
What operating system and processor architecture are you using (
go env
)?set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\go;D:\code\analyzer
set GORACE=
set GOROOT=D:\devtool\go64
set GOTOOLDIR=D:\devtool\go64\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\msys64\tmp\go-build642962111=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
What did you do?
I use this code to use jsonrpc:
What did you expect to see?
I think "DoMap2" should return the same of "DoMap"
What did you see instead?
I use "go run client.go" to test the program,but the output is:
It seems “DoMap2” return an error, but "DoMap" and "Multiply" return no error
The text was updated successfully, but these errors were encountered: