I came to this page specifically looking for a way to format an error string. So if someone needs help with the same, you want to use the fmt.Errorf()
function.
The method signature is func Errorf(format string, a ...interface{}) error
.
It returns the formatted string as a value that satisfies the error
interface.
You can look up more details in the documentation - https://golang.org/pkg/fmt/#Errorf.