File tree Expand file tree Collapse file tree 3 files changed +22
-13
lines changed Expand file tree Collapse file tree 3 files changed +22
-13
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ import "github.com/francoispqt/gojay"
11
11
// UnmarshalJSONObject implements gojay's UnmarshalerJSONObject
12
12
func (v * Error ) UnmarshalJSONObject (dec * gojay.Decoder , k string ) error {
13
13
switch k {
14
- case "code" :
14
+ case keyCode :
15
15
return dec .Int64 ((* int64 )(& v .Code ))
16
- case "message" :
16
+ case keyMessage :
17
17
return dec .String (& v .Message )
18
18
}
19
19
return nil
@@ -24,8 +24,8 @@ func (v *Error) NKeys() int { return 2 }
24
24
25
25
// MarshalJSONObject implements gojay's MarshalerJSONObject
26
26
func (v * Error ) MarshalJSONObject (enc * gojay.Encoder ) {
27
- enc .IntKey ("code" , int (v .Code ))
28
- enc .StringKey ("message" , v .Message )
27
+ enc .IntKey (keyCode , int (v .Code ))
28
+ enc .StringKey (keyMessage , v .Message )
29
29
}
30
30
31
31
// IsNil returns wether the structure is nil value or not
Original file line number Diff line number Diff line change
1
+ // Copyright 2019 The go-language-server Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ // +build gojay
6
+
7
+ package jsonrpc2
8
+
9
+ const (
10
+ keyCode = "code"
11
+ keyError = "error"
12
+ keyID = "id"
13
+ keyJSONRPC = "jsonrpc"
14
+ keyMessage = "message"
15
+ keyMethod = "method"
16
+ keyParams = "params"
17
+ keyResult = "result"
18
+ )
Original file line number Diff line number Diff line change @@ -12,15 +12,6 @@ import (
12
12
"github.com/francoispqt/gojay"
13
13
)
14
14
15
- const (
16
- keyJSONRPC = "jsonrpc"
17
- keyID = "id"
18
- keyMethod = "method"
19
- keyParams = "params"
20
- keyError = "error"
21
- keyResult = "result"
22
- )
23
-
24
15
// UnmarshalJSONObject implements gojay's UnmarshalerJSONObject
25
16
func (v * Request ) UnmarshalJSONObject (dec * gojay.Decoder , k string ) error {
26
17
switch k {
You can’t perform that action at this time.
0 commit comments