mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-30 01:46:23 +00:00
Fix go lint error and add golint checks to a pre-commit hook
This commit is contained in:
@@ -20,7 +20,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// First pass to encapsulate fields for more informative error messages.
|
||||
// KustomizationError represents an error with a kustomization.
|
||||
type KustomizationError struct {
|
||||
KustomizationPath string
|
||||
ErrorMsg string
|
||||
@@ -30,6 +30,7 @@ func (ke KustomizationError) Error() string {
|
||||
return fmt.Sprintf("Kustomization File [%s]: %s\n", ke.KustomizationPath, ke.ErrorMsg)
|
||||
}
|
||||
|
||||
// KustomizationErrors collects all errors.
|
||||
type KustomizationErrors struct {
|
||||
kErrors []error
|
||||
}
|
||||
@@ -42,14 +43,17 @@ func (ke *KustomizationErrors) Error() string {
|
||||
return errormsg
|
||||
}
|
||||
|
||||
// Append adds error to a collection of errors.
|
||||
func (ke *KustomizationErrors) Append(e error) {
|
||||
ke.kErrors = append(ke.kErrors, e)
|
||||
}
|
||||
|
||||
// Get returns all collected errors.
|
||||
func (ke *KustomizationErrors) Get() []error {
|
||||
return ke.kErrors
|
||||
}
|
||||
|
||||
// BatchAppend adds all errors from another KustomizationErrors
|
||||
func (ke *KustomizationErrors) BatchAppend(e KustomizationErrors) {
|
||||
for _, err := range e.Get() {
|
||||
ke.kErrors = append(ke.kErrors, err)
|
||||
|
||||
Reference in New Issue
Block a user