Interesting case. EOL comments becoming full line comments switch order <line>-<comment>.

Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–7 unchanged (7 lines)
8 "bytes"
9 "fmt"
10 "reflect"
11
12 "github.com/gin-gonic/gin/internal/json"
13)
14
15type ErrorType uint64
16
17const (
18 ErrorTypeBind ErrorType = 1 << 63 // used when c.Bind() fails
19 ErrorTypeRender ErrorType = 1 << 62 // used when c.Render() fails
20 ErrorTypePrivate ErrorType = 1 << 0
21 ErrorTypePublic ErrorType = 1 << 1
22
23 ErrorTypeAny ErrorType = 1<<64 - 1
24 ErrorTypeNu = 2
25)
26
27type Error struct {
28 Err error
29 Type ErrorType
30 Meta interface{}
31}
32
33type errorMsgs []*Error
34
35var _ error = &Error{}
36
37func (msg *Error) SetType(flags ErrorType) *Error {
38 msg.Type = flags
39 return msg
40}
41
42func (msg *Error) SetMeta(data interface{}) *Error {
43 msg.Meta = data
44 return msg
45}
46
47func (msg *Error) JSON() interface{} {
…lines 48–65 unchanged (18 lines)
66}
67
68// MarshalJSON implements the json.Marshaller interface.
69func (msg *Error) MarshalJSON() ([]byte, error) {
70 return json.Marshal(msg.JSON())
71}
72
73// Error implements the error interface
74func (msg Error) Error() string {
75 return msg.Err.Error()
76}
77
78func (msg *Error) IsType(flags ErrorType) bool {
79 return (msg.Type & flags) > 0
80}
81
82// ByType returns a readonly copy filtered the byte.
83// ie ByType(gin.ErrorTypePublic) returns a slice of errors with type=ErrorTypePublic.
…lines 84–133 unchanged (50 lines)
134 for i, err := range a {
135 json[i] = err.JSON()
136 }
137 return json
138 }
139}
140
141func (a errorMsgs) MarshalJSON() ([]byte, error) {
142 return json.Marshal(a.JSON())
143}
144
145func (a errorMsgs) String() string {
146 if len(a) == 0 {
…lines 147–158 unchanged (12 lines)

After

…lines 1–8 unchanged (8 lines)
9 "fmt"
10 "reflect"
11
12 "github.com/gin-gonic/gin/internal/json"
13)
14
15// ErrorType is an unsigned 64-bit error code as defined in the gin spec.
16type ErrorType uint64
17
18const (
19 // ErrorTypeBind is used when Context.Bind() fails.
20 ErrorTypeBind ErrorType = 1 << 63
21 // ErrorTypeRender is used when Context.Render() fails.
22 ErrorTypeRender ErrorType = 1 << 62
23 // ErrorTypePrivate indicates a private error.
24 ErrorTypePrivate ErrorType = 1 << 0
25 // ErrorTypePublic indicates a public error.
26 ErrorTypePublic ErrorType = 1 << 1
27 // ErrorTypeAny indicates other any error.
28 ErrorTypeAny ErrorType = 1<<64 - 1
29 ErrorTypeNu = 2
30)
31
32// Error represents a error's specification.
33type Error struct {
34 Err error
35 Type ErrorType
36 Meta interface{}
37}
38
39type errorMsgs []*Error
40
41var _ error = &Error{}
42
43// SetType sets the error's type.
44func (msg *Error) SetType(flags ErrorType) *Error {
45 msg.Type = flags
46 return msg
47}
48
49// SetMeta sets the error's meta data.
50func (msg *Error) SetMeta(data interface{}) *Error {
51 msg.Meta = data
52 return msg
53}
54
55func (msg *Error) JSON() interface{} {
…lines 56–73 unchanged (18 lines)
74}
75
76// MarshalJSON implements the json.Marshaller interface.
77func (msg *Error) MarshalJSON() ([]byte, error) {
78 return json.Marshal(msg.JSON())
79}
80
81// Error implements the error interface.
82func (msg Error) Error() string {
83 return msg.Err.Error()
84}
85
86// IsType judges one error.
87func (msg *Error) IsType(flags ErrorType) bool {
88 return (msg.Type & flags) > 0
89}
90
91// ByType returns a readonly copy filtered the byte.
92// ie ByType(gin.ErrorTypePublic) returns a slice of errors with type=ErrorTypePublic.
…lines 93–143 unchanged (51 lines)
144 json[i] = err.JSON()
145 }
146 return json
147 }
148}
149
150// MarshalJSON implements the json.Marshaller interface.
151func (a errorMsgs) MarshalJSON() ([]byte, error) {
152 return json.Marshal(a.JSON())
153}
154
155func (a errorMsgs) String() string {
156 if len(a) == 0 {
…lines 157–168 unchanged (12 lines)

Before

source_file
comment "// Copyright 2014 Manu Martinez-Almeida. All rights reserve"...
comment "// Use of this source code is governed by a MIT style"
comment "// license that can be found in the LICENSE file."
package_clause
package "package"
package_identifier "gin"
import_declaration (+25 nodes collapsed)
type_declaration
type "type"
type_spec
type_identifier "ErrorType"
type_identifier "uint64"
const_declaration
const "const"
( "("
const_spec
identifier "ErrorTypeBind"
type_identifier "ErrorType"
= "="
expression_list
binary_expression
int_literal "1"
<< "<<"
int_literal "63"
comment "// used when c.Bind() fails"
const_spec
identifier "ErrorTypeRender"
type_identifier "ErrorType"
= "="
expression_list
binary_expression
int_literal "1"
<< "<<"
int_literal "62"
comment "// used when c.Render() fails"
const_spec
identifier "ErrorTypePrivate"
type_identifier "ErrorType"
= "="
expression_list
binary_expression
int_literal "1"
<< "<<"
int_literal "0"
const_spec
identifier "ErrorTypePublic"
type_identifier "ErrorType"
= "="
expression_list
binary_expression
int_literal "1"
<< "<<"
int_literal "1"
const_spec
identifier "ErrorTypeAny"
type_identifier "ErrorType"
= "="
expression_list
binary_expression
binary_expression
int_literal "1"
<< "<<"
int_literal "64"
- "-"
int_literal "1"
const_spec
identifier "ErrorTypeNu"
= "="
expression_list
int_literal "2"
) ")"
type_declaration (+21 nodes collapsed)
type_declaration
type "type"
type_spec
type_identifier "errorMsgs"
slice_type
[ "["
] "]"
pointer_type
* "*"
type_identifier "Error"
var_declaration
var "var"
var_spec
identifier "_"
type_identifier "error"
= "="
expression_list
unary_expression
& "&"
composite_literal
type_identifier "Error"
literal_value
{ "{"
} "}"
method_declaration (+37 nodes collapsed)
method_declaration (+40 nodes collapsed)
method_declaration (+221 nodes collapsed)
comment "// MarshalJSON implements the json.Marshaller interface."
method_declaration (+48 nodes collapsed)
comment "// Error implements the error interface"
method_declaration (+31 nodes collapsed)
method_declaration (+38 nodes collapsed)
comment "// ByType returns a readonly copy filtered the byte."
comment "// ie ByType(gin.ErrorTypePublic) returns a slice of errors "...
method_declaration (+104 nodes collapsed)
comment "// Last returns the last error in the slice. It returns nil "...
comment "// Shortcut for errors[len(errors)-1]."
method_declaration (+56 nodes collapsed)
comment "// Errors returns an array will all the error messages."
comment "// Example:"
comment "// \t\tc.Error(errors.New(\"first\"))"
comment "// \t\tc.Error(errors.New(\"second\"))"
comment "// \t\tc.Error(errors.New(\"third\"))"
comment "// \t\tc.Errors.Errors() // == []string{\"first\", \"second\", \"th"...
method_declaration (+95 nodes collapsed)
method_declaration (+127 nodes collapsed)
method_declaration (+46 nodes collapsed)
method_declaration (+135 nodes collapsed)

After

source_file
comment "// Copyright 2014 Manu Martinez-Almeida. All rights reserve"...
comment "// Use of this source code is governed by a MIT style"
comment "// license that can be found in the LICENSE file."
package_clause
package "package"
package_identifier "gin"
import_declaration (+25 nodes collapsed)
comment "// ErrorType is an unsigned 64-bit error code as defined in "...
type_declaration
type "type"
type_spec
type_identifier "ErrorType"
type_identifier "uint64"
const_declaration
const "const"
( "("
comment "// ErrorTypeBind is used when Context.Bind() fails."
const_spec
identifier "ErrorTypeBind"
type_identifier "ErrorType"
= "="
expression_list
binary_expression
int_literal "1"
<< "<<"
int_literal "63"
comment "// ErrorTypeRender is used when Context.Render() fails."
const_spec
identifier "ErrorTypeRender"
type_identifier "ErrorType"
= "="
expression_list
binary_expression
int_literal "1"
<< "<<"
int_literal "62"
comment "// ErrorTypePrivate indicates a private error."
const_spec
identifier "ErrorTypePrivate"
type_identifier "ErrorType"
= "="
expression_list
binary_expression
int_literal "1"
<< "<<"
int_literal "0"
comment "// ErrorTypePublic indicates a public error."
const_spec
identifier "ErrorTypePublic"
type_identifier "ErrorType"
= "="
expression_list
binary_expression
int_literal "1"
<< "<<"
int_literal "1"
comment "// ErrorTypeAny indicates other any error."
const_spec
identifier "ErrorTypeAny"
type_identifier "ErrorType"
= "="
expression_list
binary_expression
binary_expression
int_literal "1"
<< "<<"
int_literal "64"
- "-"
int_literal "1"
const_spec
identifier "ErrorTypeNu"
= "="
expression_list
int_literal "2"
) ")"
comment "// Error represents a error's specification."
type_declaration (+21 nodes collapsed)
type_declaration
type "type"
type_spec
type_identifier "errorMsgs"
slice_type
[ "["
] "]"
pointer_type
* "*"
type_identifier "Error"
var_declaration
var "var"
var_spec
identifier "_"
type_identifier "error"
= "="
expression_list
unary_expression
& "&"
composite_literal
type_identifier "Error"
literal_value
{ "{"
} "}"
comment "// SetType sets the error's type."
method_declaration (+37 nodes collapsed)
comment "// SetMeta sets the error's meta data."
method_declaration (+40 nodes collapsed)
method_declaration (+221 nodes collapsed)
comment "// MarshalJSON implements the json.Marshaller interface."
method_declaration (+48 nodes collapsed)
comment "// Error implements the error interface."
method_declaration (+31 nodes collapsed)
comment "// IsType judges one error."
method_declaration (+38 nodes collapsed)
comment "// ByType returns a readonly copy filtered the byte."
comment "// ie ByType(gin.ErrorTypePublic) returns a slice of errors "...
method_declaration (+104 nodes collapsed)
comment "// Last returns the last error in the slice. It returns nil "...
comment "// Shortcut for errors[len(errors)-1]."
method_declaration (+56 nodes collapsed)
comment "// Errors returns an array will all the error messages."
comment "// Example:"
comment "// \t\tc.Error(errors.New(\"first\"))"
comment "// \t\tc.Error(errors.New(\"second\"))"
comment "// \t\tc.Error(errors.New(\"third\"))"
comment "// \t\tc.Errors.Errors() // == []string{\"first\", \"second\", \"th"...
method_declaration (+95 nodes collapsed)
method_declaration (+127 nodes collapsed)
comment "// MarshalJSON implements the json.Marshaller interface."
method_declaration (+46 nodes collapsed)
method_declaration (+135 nodes collapsed)