Fix go lint error and add golint checks to a pre-commit hook

This commit is contained in:
Oleg Atamanenko
2018-06-09 23:05:26 -04:00
parent 2b05d39067
commit c994130005
18 changed files with 58 additions and 24 deletions

View File

@@ -67,7 +67,7 @@ type Kustomization struct {
Vars []Var `json:"vars,omitempty" yaml:"vars,omitempty"`
}
// ConfigMapArg contains the metadata of how to generate a configmap.
// ConfigMapArgs contains the metadata of how to generate a configmap.
type ConfigMapArgs struct {
// Name of the configmap.
// The full name should be Kustomization.NamePrefix + Configmap.Name +
@@ -84,7 +84,7 @@ type ConfigMapArgs struct {
DataSources `json:",inline,omitempty" yaml:",inline,omitempty"`
}
// SecretGenerator contains the metadata of how to generate a secret.
// SecretArgs contains the metadata of how to generate a secret.
type SecretArgs struct {
// Name of the secret.
// The full name should be Kustomization.NamePrefix + SecretGenerator.Name +

View File

@@ -40,6 +40,7 @@ type Var struct {
FieldRef corev1.ObjectFieldSelector `json:"fieldref,omitempty" yaml:"objref,omitempty"`
}
// Defaulting sets reference to field used by default.
func (v *Var) Defaulting() {
if (corev1.ObjectFieldSelector{}) == v.FieldRef {
v.FieldRef = corev1.ObjectFieldSelector{FieldPath: "metadata.name"}