The workaround is even more cancerous but you could wrap it in a struct:
type NotificationWrapper struct {
// This field holds the actual notification data
Value interface{}
}
And use it like:
func NewPushNotification(token, title, message string, expires time.Time) NotificationWrapper {
return NotificationWrapper{
Value: PushNotification{
DeviceToken: token,
Title: title,
Message: message,
ExpiresAt: expires,
},
}
}
And destructure it with something like
func ProcessNotification(notification NotificationWrapper) string {
switch n := notification.Value.(type) {
Roll it all up in a nice syntax with a preprocessor haha