19 lines
425 B
Go
19 lines
425 B
Go
package errors
|
|
|
|
import "fmt"
|
|
|
|
// UnknownPackage represents unknown package errors.
|
|
type UnknownPackage struct {
|
|
Name string
|
|
CorrectName string
|
|
}
|
|
|
|
// Error generates the string representation.
|
|
func (err *UnknownPackage) Error() string {
|
|
if err.CorrectName != "" {
|
|
return fmt.Sprintf("Unknown package '%s', did you mean '%s'?", err.Name, err.CorrectName)
|
|
}
|
|
|
|
return fmt.Sprintf("Unknown package '%s'", err.Name)
|
|
}
|