From ab4f7f28be410e47f8c48c2c4a6f2602d1f9736e Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 30 Aug 2017 11:59:08 +0900 Subject: [PATCH] ing --- golint.json | 39 +++++++++++++++++++++++++++++ protocol/jsonrpc/handler.go | 7 +++--- protocol/jsonrpc/server_request.go | 7 +++--- protocol/jsonrpc/server_response.go | 7 +++--- 4 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 golint.json 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"` }