You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today constraints hold important data in unexported fields and provide getters to access data.
It seems like there is not much value in these getters: Deppy itself doesn't seem to use them and on the user side they are normally not required in production code.
However this makes testing of components which generate variables with constraints harder for deppy users. Users have to use something like go-cmp with AllowUnexported & use constructors such as constraint.AtMost() to create constraints instead of simply just comparing literals.
I think we should explore exporting constraint fields and removing getter methods.
For example, AtMostConstraint which looks today like this:
Today constraints hold important data in unexported fields and provide getters to access data.
It seems like there is not much value in these getters: Deppy itself doesn't seem to use them and on the user side they are normally not required in production code.
However this makes testing of components which generate variables with constraints harder for deppy users. Users have to use something like
go-cmp
withAllowUnexported
& use constructors such asconstraint.AtMost()
to create constraints instead of simply just comparing literals.I think we should explore exporting constraint fields and removing getter methods.
For example,
AtMostConstraint
which looks today like this:deppy/pkg/deppy/constraint/constraint.go
Lines 159 to 177 in 3a99ed7
will be turned into something like this:
The text was updated successfully, but these errors were encountered: