Make the constructor of the Error struct private to prevent direct instantiation. Instead, introduce a new make function to create a new error with a specific message. Alternatively, users can continue using the existing format function to create a new error while formatting its message.
Make the constructor of the
Errorstruct private to prevent direct instantiation. Instead, introduce a newmakefunction to create a new error with a specific message. Alternatively, users can continue using the existingformatfunction to create a new error while formatting its message.