diff --git a/.golangci.yml b/.golangci.yml index bfe8e7b65c7..b6951f025ef 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -10,7 +10,7 @@ linters: - goimports - gosec - gocritic - - golint + - revive - misspell output: uniq-by-line: false diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index 97e794d36f6..6c5ee4883eb 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -133,7 +133,7 @@ func newConfigValidationController(ctx context.Context, cmw configmap.Watcher) * } func newConversionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl { - // nolint: golint + // nolint: revive var ( v1alpha1GroupVersion = v1alpha1.SchemeGroupVersion.Version v1beta1GroupVersion = v1beta1.SchemeGroupVersion.Version diff --git a/pkg/apis/pipeline/controller.go b/pkg/apis/pipeline/controller.go index 33d8d464c05..cc4cfdfc932 100644 --- a/pkg/apis/pipeline/controller.go +++ b/pkg/apis/pipeline/controller.go @@ -18,7 +18,7 @@ package pipeline const ( // PipelineRunControllerName holds the name of the PipelineRun controller - // nolint: golint + // nolint: revive PipelineRunControllerName = "PipelineRun" // TaskRunControllerName holds the name of the TaskRun controller diff --git a/pkg/apis/pipeline/v1alpha1/cluster_task_conversion.go b/pkg/apis/pipeline/v1alpha1/cluster_task_conversion.go index 61afb3e7a65..dd1af48e347 100644 --- a/pkg/apis/pipeline/v1alpha1/cluster_task_conversion.go +++ b/pkg/apis/pipeline/v1alpha1/cluster_task_conversion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// nolint: golint +// nolint: revive package v1alpha1 import ( diff --git a/pkg/apis/pipeline/v1alpha1/condition_validation.go b/pkg/apis/pipeline/v1alpha1/condition_validation.go index 1aed47511cb..414a6b91b17 100644 --- a/pkg/apis/pipeline/v1alpha1/condition_validation.go +++ b/pkg/apis/pipeline/v1alpha1/condition_validation.go @@ -52,8 +52,5 @@ func (cs *ConditionSpec) Validate(ctx context.Context) *apis.FieldError { } } - if err := validateSteps([]Step{cs.Check}).ViaField("Check"); err != nil { - return err - } - return nil + return validateSteps([]Step{cs.Check}).ViaField("Check") } diff --git a/pkg/apis/pipeline/v1alpha1/pipeline_conversion.go b/pkg/apis/pipeline/v1alpha1/pipeline_conversion.go index 63abd3e78ba..ecde15b7e2e 100644 --- a/pkg/apis/pipeline/v1alpha1/pipeline_conversion.go +++ b/pkg/apis/pipeline/v1alpha1/pipeline_conversion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// nolint: golint +// nolint: revive package v1alpha1 import ( diff --git a/pkg/apis/pipeline/v1alpha1/pipeline_validation.go b/pkg/apis/pipeline/v1alpha1/pipeline_validation.go index 40308bbce06..7492a4d0c2d 100644 --- a/pkg/apis/pipeline/v1alpha1/pipeline_validation.go +++ b/pkg/apis/pipeline/v1alpha1/pipeline_validation.go @@ -175,11 +175,7 @@ func (ps *PipelineSpec) Validate(ctx context.Context) *apis.FieldError { } // Validate the pipeline's workspaces. - if err := validatePipelineWorkspaces(ps.Workspaces, ps.Tasks); err != nil { - return err - } - - return nil + return validatePipelineWorkspaces(ps.Workspaces, ps.Tasks) } func validatePipelineTasks(ctx context.Context, tasks []PipelineTask) *apis.FieldError { diff --git a/pkg/apis/pipeline/v1alpha1/pipelinerun_conversion.go b/pkg/apis/pipeline/v1alpha1/pipelinerun_conversion.go index 929228cd526..f23d6552e3a 100644 --- a/pkg/apis/pipeline/v1alpha1/pipelinerun_conversion.go +++ b/pkg/apis/pipeline/v1alpha1/pipelinerun_conversion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// nolint: golint +// nolint: revive package v1alpha1 import ( diff --git a/pkg/apis/pipeline/v1alpha1/run_validation.go b/pkg/apis/pipeline/v1alpha1/run_validation.go index fe011f08b0f..483c918de66 100644 --- a/pkg/apis/pipeline/v1alpha1/run_validation.go +++ b/pkg/apis/pipeline/v1alpha1/run_validation.go @@ -70,9 +70,5 @@ func (rs *RunSpec) Validate(ctx context.Context) *apis.FieldError { return err } - if err := validateWorkspaceBindings(ctx, rs.Workspaces); err != nil { - return err - } - - return nil + return validateWorkspaceBindings(ctx, rs.Workspaces) } diff --git a/pkg/apis/pipeline/v1alpha1/task_conversion.go b/pkg/apis/pipeline/v1alpha1/task_conversion.go index b4e350a7107..0dcec4da0cf 100644 --- a/pkg/apis/pipeline/v1alpha1/task_conversion.go +++ b/pkg/apis/pipeline/v1alpha1/task_conversion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// nolint: golint +// nolint: revive package v1alpha1 import ( diff --git a/pkg/apis/pipeline/v1alpha1/task_validation.go b/pkg/apis/pipeline/v1alpha1/task_validation.go index e0a3b3dadfa..352cd9dafe1 100644 --- a/pkg/apis/pipeline/v1alpha1/task_validation.go +++ b/pkg/apis/pipeline/v1alpha1/task_validation.go @@ -140,10 +140,7 @@ func (ts *TaskSpec) Validate(ctx context.Context) *apis.FieldError { return err } // Deprecated - if err := validateResourceVariables(ts.Steps, ts.Inputs, ts.Outputs, ts.Resources); err != nil { - return err - } - return nil + return validateResourceVariables(ts.Steps, ts.Inputs, ts.Outputs, ts.Resources) } // validateDeclaredWorkspaces will make sure that the declared workspaces do not try to use diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_conversion.go b/pkg/apis/pipeline/v1alpha1/taskrun_conversion.go index 3db9f734e42..898a9e4d4d2 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_conversion.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_conversion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// nolint: golint +// nolint: revive package v1alpha1 import ( diff --git a/pkg/apis/pipeline/v1beta1/cluster_task_conversion.go b/pkg/apis/pipeline/v1beta1/cluster_task_conversion.go index 275c64e24da..b17d0ff752d 100644 --- a/pkg/apis/pipeline/v1beta1/cluster_task_conversion.go +++ b/pkg/apis/pipeline/v1beta1/cluster_task_conversion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// nolint: golint +// nolint: revive package v1beta1 import ( diff --git a/pkg/apis/pipeline/v1beta1/pipeline_conversion.go b/pkg/apis/pipeline/v1beta1/pipeline_conversion.go index b60929c343a..7ec0697b30d 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_conversion.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_conversion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// nolint: golint +// nolint: revive package v1beta1 import ( diff --git a/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go b/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go index 4ba1da51d92..9772707ed9c 100644 --- a/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// nolint: golint +// nolint: revive package v1beta1 import ( diff --git a/pkg/apis/pipeline/v1beta1/resource_types_validation.go b/pkg/apis/pipeline/v1beta1/resource_types_validation.go index 95cfa771101..e36c4e29706 100644 --- a/pkg/apis/pipeline/v1beta1/resource_types_validation.go +++ b/pkg/apis/pipeline/v1beta1/resource_types_validation.go @@ -67,10 +67,7 @@ func (tr *TaskRunResources) Validate(ctx context.Context) *apis.FieldError { if err := validateTaskRunResources(ctx, tr.Inputs, "spec.resources.inputs.name"); err != nil { return err } - if err := validateTaskRunResources(ctx, tr.Outputs, "spec.resources.outputs.name"); err != nil { - return err - } - return nil + return validateTaskRunResources(ctx, tr.Outputs, "spec.resources.outputs.name") } // validateTaskRunResources validates that diff --git a/pkg/apis/pipeline/v1beta1/task_conversion.go b/pkg/apis/pipeline/v1beta1/task_conversion.go index c8a5a284923..1d150a2083f 100644 --- a/pkg/apis/pipeline/v1beta1/task_conversion.go +++ b/pkg/apis/pipeline/v1beta1/task_conversion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// nolint: golint +// nolint: revive package v1beta1 import ( diff --git a/pkg/apis/pipeline/v1beta1/taskrun_conversion.go b/pkg/apis/pipeline/v1beta1/taskrun_conversion.go index 8ac827c83c9..0244cfb8310 100644 --- a/pkg/apis/pipeline/v1beta1/taskrun_conversion.go +++ b/pkg/apis/pipeline/v1beta1/taskrun_conversion.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// nolint: golint +// nolint: revive package v1beta1 import ( diff --git a/pkg/pullrequest/disk.go b/pkg/pullrequest/disk.go index e453e0c3d39..d6d1c5e4003 100644 --- a/pkg/pullrequest/disk.go +++ b/pkg/pullrequest/disk.go @@ -96,11 +96,7 @@ func ToDisk(r *Resource, path string) error { if err := refToDisk("head", path, r.PR.Head); err != nil { return err } - if err := refToDisk("base", path, r.PR.Base); err != nil { - return err - } - - return nil + return refToDisk("base", path, r.PR.Base) } func commentsToDisk(path string, comments []*scm.Comment) error { diff --git a/pkg/reconciler/pipelinerun/resources/apply.go b/pkg/reconciler/pipelinerun/resources/apply.go index 8773e295bff..a2aba9fa6d7 100644 --- a/pkg/reconciler/pipelinerun/resources/apply.go +++ b/pkg/reconciler/pipelinerun/resources/apply.go @@ -174,7 +174,7 @@ func ApplyTaskResultsToPipelineResults( customTaskStatuses[runStatus.PipelineTaskName] = runStatus } - var runResults []v1beta1.PipelineRunResult = nil + var runResults []v1beta1.PipelineRunResult stringReplacements := map[string]string{} for _, pipelineResult := range results { variablesInPipelineResult, _ := v1beta1.GetVarSubstitutionExpressionsForPipelineResult(pipelineResult) diff --git a/pkg/termination/write.go b/pkg/termination/write.go index 41e556a34ac..b0594548306 100644 --- a/pkg/termination/write.go +++ b/pkg/termination/write.go @@ -61,10 +61,7 @@ func WriteMessage(path string, pro []v1beta1.PipelineResourceResult) error { if _, err = f.Write(jsonOutput); err != nil { return err } - if err := f.Sync(); err != nil { - return err - } - return nil + return f.Sync() } // MessageLengthError indicate the length of termination message of container is beyond 4096 which is the max length read by kubenates diff --git a/test/controller.go b/test/controller.go index fb97c51611c..435a99ac398 100644 --- a/test/controller.go +++ b/test/controller.go @@ -154,7 +154,7 @@ func AddToInformer(t *testing.T, store cache.Store) func(ktesting.Action) (bool, // SeedTestData returns Clients and Informers populated with the // given Data. -// nolint: golint +// nolint: revive func SeedTestData(t *testing.T, ctx context.Context, d Data) (Clients, Informers) { c := Clients{ Kube: fakekubeclient.Get(ctx), diff --git a/test/v1alpha1/controller.go b/test/v1alpha1/controller.go index b9472e38669..ebac2cce8f6 100644 --- a/test/v1alpha1/controller.go +++ b/test/v1alpha1/controller.go @@ -85,7 +85,7 @@ type Assets struct { // SeedTestData returns Clients and Informers populated with the // given Data. -// nolint: golint +// nolint: revive func SeedTestData(t *testing.T, ctx context.Context, d Data) (Clients, Informers) { c := Clients{ Kube: fakekubeclient.Get(ctx),