diff --git a/golint.json b/golint.json new file mode 100644 index 0000000..6380714 --- /dev/null +++ b/golint.json @@ -0,0 +1,39 @@ +{ + "DisableAll": true, + "Enable": [ + "aligncheck", + "deadcode", + "dupl", + "errcheck", + "gas", + "goconst", + "gocyclo", + "gofmt", + "goimports", + "golint", + "gotype", + "ineffassign", + "interfacer", + "lll", + "megacheck", + "misspell", + "structcheck", + "test", + "testify", + "unconvert", + "varcheck", + "vet", + "vetshadow" + ], + "Aggregate": true, + "Concurrency": 16, + "Cyclo": 60, + "Deadline": "60s", + "DuplThreshold": 50, + "EnableGC": true, + "LineLength": 120, + "MinConfidence": 0.8, + "MinOccurrences": 3, + "MinConstLength": 3, + "Sort": ["severity"] +} \ No newline at end of file diff --git a/protocol/jsonrpc/handler.go b/protocol/jsonrpc/handler.go index 7b75421..1de5cd4 100644 --- a/protocol/jsonrpc/handler.go +++ b/protocol/jsonrpc/handler.go @@ -48,9 +48,10 @@ func (h *messageHandler) onRequest(soc gws.Socket, req *ServerRequest) []byte { result, err := h.o.OnRequest(soc, req.Method, req.Params) res := &ServerResponse{ - Id: req.Id, - Result: result, - Error: err, + Protocol: req.Protocol, + Result: result, + Error: err, + Id: req.Id, } j, err := json.Marshal(res) diff --git a/protocol/jsonrpc/server_request.go b/protocol/jsonrpc/server_request.go index dc6348f..3aae219 100644 --- a/protocol/jsonrpc/server_request.go +++ b/protocol/jsonrpc/server_request.go @@ -5,9 +5,10 @@ import ( ) type ServerRequest struct { - Method string `json:"method"` - Params []string `json:"params,omitempty"` - Id *json.RawMessage `json:"id,omitempty"` + Protocol string `json:"protocol"` + Method string `json:"method"` + Params []string `json:"params,omitempty"` + Id *json.RawMessage `json:"id,omitempty"` } func (r *ServerRequest) reset() { diff --git a/protocol/jsonrpc/server_response.go b/protocol/jsonrpc/server_response.go index 4bd72d9..e3e84bf 100644 --- a/protocol/jsonrpc/server_response.go +++ b/protocol/jsonrpc/server_response.go @@ -5,7 +5,8 @@ import ( ) type ServerResponse struct { - Id *json.RawMessage `json:"id,omitempty"` - Result interface{} `json:"result,omitempty"` - Error interface{} `json:"error,omitempty"` + Protocol string `json:"protocol"` + Result interface{} `json:"result,omitempty"` + Error interface{} `json:"error,omitempty"` + Id *json.RawMessage `json:"id,omitempty"` }