This commit is contained in:
crusader 2017-08-30 11:59:08 +09:00
parent 5a3f20551f
commit ab4f7f28be
4 changed files with 51 additions and 9 deletions

39
golint.json Normal file
View File

@ -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"]
}

View File

@ -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)

View File

@ -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() {

View File

@ -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"`
}