package s3browser import "fmt" type extendedError struct { Message string Code string } func (err *extendedError) Error() string { return err.Message } func (err *extendedError) Extensions() map[string]interface{} { return map[string]interface{}{ "code": err.Code, } } func extendError(code, format string, a ...interface{}) *extendedError { return &extendedError{ Message: fmt.Sprintf(format, a...), Code: code, } }