mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
Fix go lint error and add golint checks to a pre-commit hook
This commit is contained in:
@@ -19,6 +19,7 @@ package error
|
||||
|
||||
import "fmt"
|
||||
|
||||
// ConfigmapError represents error with a configmap.
|
||||
type ConfigmapError struct {
|
||||
Path string
|
||||
ErrorMsg string
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// PatchError represents error during Patch.
|
||||
type PatchError struct {
|
||||
KustomizationPath string
|
||||
PatchFilepath string
|
||||
|
||||
@@ -18,7 +18,7 @@ package error
|
||||
|
||||
import "fmt"
|
||||
|
||||
// First pass to encapsulate fields for more informative error messages.
|
||||
// ResourceError represents error in a resource.
|
||||
type ResourceError struct {
|
||||
KustomizationPath string
|
||||
ResourceFilepath string
|
||||
|
||||
@@ -18,9 +18,11 @@ package error
|
||||
|
||||
import "fmt"
|
||||
|
||||
// SecretError represents error with a secret.
|
||||
type SecretError struct {
|
||||
KustomizationPath string
|
||||
ErrorMsg string
|
||||
// ErrorMsg is an error message
|
||||
ErrorMsg string
|
||||
}
|
||||
|
||||
func (e SecretError) Error() string {
|
||||
|
||||
Reference in New Issue
Block a user