diff --git a/.golangci.yml b/.golangci.yml index 6a60d6b07..9e9854253 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -174,8 +174,8 @@ issues: linters: - noctx # local to tink: kubebuilder needs the stdlib invalid `inline` json struct tag - - path: pkg/apis/.* - text: "struct-tag" + - path: api/.* + text: "struct-tag: unknown option 'inline'" - path: main\.go linters: - noctx diff --git a/internal/server/kubernetes_api_workflow.go b/internal/server/kubernetes_api_workflow.go index 6bf78d6eb..691a33cd3 100644 --- a/internal/server/kubernetes_api_workflow.go +++ b/internal/server/kubernetes_api_workflow.go @@ -54,13 +54,13 @@ func (s *KubernetesBackedServer) getCurrentAssignedNonTerminalWorkflowsForWorker } func (s *KubernetesBackedServer) getWorkflowByName(ctx context.Context, workflowID, namespace string) (*v1alpha1.Workflow, error) { - workflow := &v1alpha1.Workflow{} - err := s.ClientFunc().Get(ctx, types.NamespacedName{Name: workflowID, Namespace: namespace}, workflow) + wflw := &v1alpha1.Workflow{} + err := s.ClientFunc().Get(ctx, types.NamespacedName{Name: workflowID, Namespace: namespace}, wflw) if err != nil { s.logger.With("workflow", workflowID).Error(err) return nil, err } - return workflow, nil + return wflw, nil } // The following APIs are used by the worker. @@ -90,7 +90,7 @@ func (s *KubernetesBackedServer) GetWorkflowActions(ctx context.Context, req *pr if err != nil { return nil, err } - return workflow.WorkflowActionListCRDToProto(wf), nil + return workflow.ActionListCRDToProto(wf), nil } // Modifies a workflow for a given workflowContext. diff --git a/internal/workflow/controller.go b/internal/workflow/controller.go index 99800c670..8d68cfa1e 100644 --- a/internal/workflow/controller.go +++ b/internal/workflow/controller.go @@ -118,7 +118,7 @@ func (c *Controller) processNewWorkflow(ctx context.Context, logger logr.Logger, } // populate Task and Action data - stored.Status = *WorkflowYAMLToStatus(tinkWf) + stored.Status = *YAMLToStatus(tinkWf) stored.Status.State = v1alpha1.WorkflowStatePending return reconcile.Result{}, nil diff --git a/internal/workflow/convert.go b/internal/workflow/convert.go index 8385abc69..3c49d9aaa 100644 --- a/internal/workflow/convert.go +++ b/internal/workflow/convert.go @@ -8,7 +8,7 @@ import ( "github.com/tinkerbell/tink/internal/proto" ) -func WorkflowToWorkflowContext(wf *v1alpha1.Workflow) *proto.WorkflowContext { +func ToWorkflowContext(wf *v1alpha1.Workflow) *proto.WorkflowContext { if wf == nil { return nil } @@ -23,7 +23,7 @@ func WorkflowToWorkflowContext(wf *v1alpha1.Workflow) *proto.WorkflowContext { } } -func WorkflowYAMLToStatus(wf *Workflow) *v1alpha1.WorkflowStatus { +func YAMLToStatus(wf *Workflow) *v1alpha1.WorkflowStatus { if wf == nil { return nil } @@ -56,7 +56,7 @@ func WorkflowYAMLToStatus(wf *Workflow) *v1alpha1.WorkflowStatus { } } -func WorkflowActionListCRDToProto(wf *v1alpha1.Workflow) *proto.WorkflowActionList { +func ActionListCRDToProto(wf *v1alpha1.Workflow) *proto.WorkflowActionList { if wf == nil { return nil } diff --git a/internal/workflow/convert_test.go b/internal/workflow/convert_test.go index de97b1fb1..63d4a86b2 100644 --- a/internal/workflow/convert_test.go +++ b/internal/workflow/convert_test.go @@ -14,7 +14,7 @@ import ( var convertTestTime = testtime.NewFrozenTimeUnix(1637361794) -func TestWorkflowToWorkflowContext(t *testing.T) { +func TestToWorkflowContext(t *testing.T) { cases := []struct { name string input *v1alpha1.Workflow @@ -82,7 +82,7 @@ func TestWorkflowToWorkflowContext(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - got := WorkflowToWorkflowContext(tc.input) + got := ToWorkflowContext(tc.input) if !reflect.DeepEqual(got, tc.want) { t.Errorf("Unexpedted response: wanted\n\t%#v\ngot\n\t%#v", tc.want, got) } @@ -90,7 +90,7 @@ func TestWorkflowToWorkflowContext(t *testing.T) { } } -func TestWorkflowActionListCRDToProto(t *testing.T) { +func TestActionListCRDToProto(t *testing.T) { cases := []struct { name string input *v1alpha1.Workflow @@ -229,7 +229,7 @@ func TestWorkflowActionListCRDToProto(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - got := WorkflowActionListCRDToProto(tc.input) + got := ActionListCRDToProto(tc.input) if diff := cmp.Diff(tc.want, got, protocmp.Transform()); diff != "" { t.Errorf("unexpected difference:\n%v", diff) } @@ -237,7 +237,7 @@ func TestWorkflowActionListCRDToProto(t *testing.T) { } } -func TestWorkflowYAMLToStatus(t *testing.T) { +func TestYAMLToStatus(t *testing.T) { cases := []struct { name string inputWf *Workflow @@ -315,7 +315,7 @@ func TestWorkflowYAMLToStatus(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - got := WorkflowYAMLToStatus(tc.inputWf) + got := YAMLToStatus(tc.inputWf) if diff := cmp.Diff(got, tc.want, protocmp.Transform()); diff != "" { t.Errorf("unexpected difference:\n%v", diff) }