Skip to content

Commit 1fec5b2

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>
1 parent 8b245b8 commit 1fec5b2

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
@@ -93,3 +93,16 @@ func (ps PercentageSize) IsZero() bool {
9393
func (ps PercentageSize) IsNegative() bool {
9494
return ps.negative
9595
}
96+
97+
// Merge implements merger interface.
98+
func (ps *PercentageSize) Merge(other any) error {
99+
otherPS, ok := other.(PercentageSize)
100+
if !ok {
101+
return fmt.Errorf("cannot merge %T with %T", ps, other)
102+
}
103+
104+
ps.raw = otherPS.raw
105+
ps.value = otherPS.value
106+
107+
return nil
108+
}

0 commit comments

Comments
 (0)