Skip to content

Commit 3aa1539

Browse files
committed
fix: implement merger for PercentageSize
Fixing issue when PercentageSize is used and instead of calling Merge it was trying to merge individual unexported fields. Signed-off-by: Mateusz Urbanek <mateusz.urbanek@siderolabs.com> (cherry picked from commit 1fec5b2)
1 parent f17d07c commit 3aa1539

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/machinery/config/types/block/percentage_size.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,16 @@ func (ps *PercentageSize) UnmarshalText(text []byte) error {
8080
func (ps PercentageSize) IsZero() bool {
8181
return ps.value == nil && ps.raw == nil
8282
}
83+
84+
// Merge implements merger interface.
85+
func (ps *PercentageSize) Merge(other any) error {
86+
otherPS, ok := other.(PercentageSize)
87+
if !ok {
88+
return fmt.Errorf("cannot merge %T with %T", ps, other)
89+
}
90+
91+
ps.raw = otherPS.raw
92+
ps.value = otherPS.value
93+
94+
return nil
95+
}

0 commit comments

Comments
 (0)