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–35 unchanged (35 lines)
36 // +k8s:optional
37 M1 *M1 `json:"m1"`
38
39 // +k8s:unionMember
40 // +k8s:optional
41 M2 *M2 `json:"m2"`
42}
43
44type D string
45
46const (
47 DM1 D = "M1"
48 DM2 D = "M2"
49)
50
51type M1 struct{}
52
53type M2 struct{}
54

After

…lines 1–36 unchanged (36 lines)
37 M1 *M1 `json:"m1"`
38
39 // +k8s:unionMember
40 // +k8s:optional
41 M2 *M2 `json:"m2"`
42
43 // +k8s:unionMember
44 // +k8s:optional
45 M3 []string `json:"m3"`
46
47 // +k8s:unionMember
48 // +k8s:optional
49 M4 map[string]string `json:"m4"`
50}
51
52type D string
53
54const (
55 DM1 D = "M1"
56 DM2 D = "M2"
57 DM3 D = "M3"
58 DM4 D = "M4"
59)
60
61type M1 struct{}
62
63type M2 struct{}
64

Before

source_file
comment "/*\nCopyright 2024 The Kubernetes Authors.\n\nLicensed under th"...
comment "// +k8s:validation-gen=TypeMeta"
comment "// +k8s:validation-gen-scheme-registry=k8s.io/code-generator"...
comment "// This is a test package."
comment "// +k8s:validation-gen-nolint"
package_clause
package "package"
package_identifier "simple"
import_declaration
import "import"
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "k8s.io/code-generator/cmd/validation-gen/testscheme"
" "\""
var_declaration
var "var"
var_spec
identifier "localSchemeBuilder"
= "="
expression_list
call_expression
selector_expression
identifier "testscheme"
. "."
field_identifier "New"
argument_list
( "("
) ")"
comment "// Discriminated union"
type_declaration
type "type"
type_spec
type_identifier "Struct"
struct_type
struct "struct"
field_declaration_list
{ "{"
field_declaration
field_identifier "TypeMeta"
type_identifier "int"
comment "// +k8s:unionDiscriminator"
field_declaration
field_identifier "D"
type_identifier "D"
raw_string_literal
` "`"
raw_string_literal_content "json:\"d\""
` "`"
comment "// +k8s:unionMember"
comment "// +k8s:optional"
field_declaration
field_identifier "M1"
pointer_type
* "*"
type_identifier "M1"
raw_string_literal
` "`"
raw_string_literal_content "json:\"m1\""
` "`"
comment "// +k8s:unionMember"
comment "// +k8s:optional"
field_declaration
field_identifier "M2"
pointer_type
* "*"
type_identifier "M2"
raw_string_literal
` "`"
raw_string_literal_content "json:\"m2\""
` "`"
} "}"
type_declaration
type "type"
type_spec
type_identifier "D"
type_identifier "string"
const_declaration
const "const"
( "("
const_spec
identifier "DM1"
type_identifier "D"
= "="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "M1"
" "\""
const_spec
identifier "DM2"
type_identifier "D"
= "="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "M2"
" "\""
) ")"
type_declaration
type "type"
type_spec
type_identifier "M1"
struct_type
struct "struct"
field_declaration_list
{ "{"
} "}"
type_declaration
type "type"
type_spec
type_identifier "M2"
struct_type
struct "struct"
field_declaration_list
{ "{"
} "}"

After

source_file
comment "/*\nCopyright 2024 The Kubernetes Authors.\n\nLicensed under th"...
comment "// +k8s:validation-gen=TypeMeta"
comment "// +k8s:validation-gen-scheme-registry=k8s.io/code-generator"...
comment "// This is a test package."
comment "// +k8s:validation-gen-nolint"
package_clause
package "package"
package_identifier "simple"
import_declaration
import "import"
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "k8s.io/code-generator/cmd/validation-gen/testscheme"
" "\""
var_declaration
var "var"
var_spec
identifier "localSchemeBuilder"
= "="
expression_list
call_expression
selector_expression
identifier "testscheme"
. "."
field_identifier "New"
argument_list
( "("
) ")"
comment "// Discriminated union"
type_declaration
type "type"
type_spec
type_identifier "Struct"
struct_type
struct "struct"
field_declaration_list
{ "{"
field_declaration
field_identifier "TypeMeta"
type_identifier "int"
comment "// +k8s:unionDiscriminator"
field_declaration
field_identifier "D"
type_identifier "D"
raw_string_literal
` "`"
raw_string_literal_content "json:\"d\""
` "`"
comment "// +k8s:unionMember"
comment "// +k8s:optional"
field_declaration
field_identifier "M1"
pointer_type
* "*"
type_identifier "M1"
raw_string_literal
` "`"
raw_string_literal_content "json:\"m1\""
` "`"
comment "// +k8s:unionMember"
comment "// +k8s:optional"
field_declaration
field_identifier "M2"
pointer_type
* "*"
type_identifier "M2"
raw_string_literal
` "`"
raw_string_literal_content "json:\"m2\""
` "`"
comment "// +k8s:unionMember"
comment "// +k8s:optional"
field_declaration
field_identifier "M3"
slice_type
[ "["
] "]"
type_identifier "string"
raw_string_literal
` "`"
raw_string_literal_content "json:\"m3\""
` "`"
comment "// +k8s:unionMember"
comment "// +k8s:optional"
field_declaration
field_identifier "M4"
map_type
map "map"
[ "["
type_identifier "string"
] "]"
type_identifier "string"
raw_string_literal
` "`"
raw_string_literal_content "json:\"m4\""
` "`"
} "}"
type_declaration
type "type"
type_spec
type_identifier "D"
type_identifier "string"
const_declaration
const "const"
( "("
const_spec
identifier "DM1"
type_identifier "D"
= "="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "M1"
" "\""
const_spec
identifier "DM2"
type_identifier "D"
= "="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "M2"
" "\""
const_spec
identifier "DM3"
type_identifier "D"
= "="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "M3"
" "\""
const_spec
identifier "DM4"
type_identifier "D"
= "="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "M4"
" "\""
) ")"
type_declaration
type "type"
type_spec
type_identifier "M1"
struct_type
struct "struct"
field_declaration_list
{ "{"
} "}"
type_declaration
type "type"
type_spec
type_identifier "M2"
struct_type
struct "struct"
field_declaration_list
{ "{"
} "}"