-
-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathenum_duplicated_different_values.yml
More file actions
60 lines (51 loc) · 1.72 KB
/
enum_duplicated_different_values.yml
File metadata and controls
60 lines (51 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
input:
input.go: |
package example
import (
input "github.com/jmattheis/goverter/execution/input"
output "github.com/jmattheis/goverter/execution/output"
)
// goverter:converter
// goverter:enum:unknown @panic
type Converter interface {
Convert(input.Color) output.Color
}
input/enum.go: |
package input
type Color int
const (
Default = Gray
Green Color = 1
Gray Color = 2
)
output/enum.go: |
package output
type Color string
const (
Default = Green
Green Color = "green"
Gray Color = "gray"
)
error: |-
Error while creating converter method:
@workdir/input.go:11
func (github.com/jmattheis/goverter/execution.Converter).Convert(github.com/jmattheis/goverter/execution/input.Color) github.com/jmattheis/goverter/execution/output.Color
[source] github.com/jmattheis/goverter/execution/input.Color
[target] github.com/jmattheis/goverter/execution/output.Color
| github.com/jmattheis/goverter/execution/input.Color
|
| | Gray(2)
| |
source.Gray
target.Gray
| |
| | Gray(gray)
|
| github.com/jmattheis/goverter/execution/output.Color
Detected multiple enum source members with the same value but different target values/actions.
Default(2) -> Default(green)
Gray(2) -> Gray(gray)
Explicitly define what the correct mapping is. E.g. by adding
goverter:enum:map Default Default
goverter:enum:map Gray Default
See https://goverter.jmattheis.de/guide/enum#mapping-enum-keys