From d2a227ba659e9ea7ddd83f6a429f72411312cd85 Mon Sep 17 00:00:00 2001 From: Matej Vasek Date: Wed, 25 Oct 2023 17:50:08 +0200 Subject: [PATCH] refactor: rename -- make functions non-exported Signed-off-by: Matej Vasek --- pkg/pipelines/tekton/resources.go | 10 +++++----- pkg/pipelines/tekton/templates.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/pipelines/tekton/resources.go b/pkg/pipelines/tekton/resources.go index 206f102a4a..adf1822807 100644 --- a/pkg/pipelines/tekton/resources.go +++ b/pkg/pipelines/tekton/resources.go @@ -18,8 +18,8 @@ import ( fn "knative.dev/func/pkg/functions" ) -func GetPipeline(f fn.Function) (*v1beta1.Pipeline, error) { - pipelineFromFile, err := LoadResource[*v1beta1.Pipeline](path.Join(f.Root, resourcesDirectory, pipelineFileName)) +func getPipeline(f fn.Function) (*v1beta1.Pipeline, error) { + pipelineFromFile, err := loadResource[*v1beta1.Pipeline](path.Join(f.Root, resourcesDirectory, pipelineFileName)) if err != nil { return nil, fmt.Errorf("cannot load resource from file: %v", err) } @@ -285,8 +285,8 @@ func GetPipeline(f fn.Function) (*v1beta1.Pipeline, error) { return &result, nil } -func GetPipelineRun(f fn.Function) (*v1beta1.PipelineRun, error) { - pipelineRunFromFile, err := LoadResource[*v1beta1.PipelineRun](path.Join(f.Root, resourcesDirectory, pipelineRunFilenane)) +func getPipelineRun(f fn.Function) (*v1beta1.PipelineRun, error) { + pipelineRunFromFile, err := loadResource[*v1beta1.PipelineRun](path.Join(f.Root, resourcesDirectory, pipelineRunFilenane)) if err != nil { return nil, fmt.Errorf("cannot load resource from file: %v", err) } @@ -434,7 +434,7 @@ type res interface { GetObjectKind() schema.ObjectKind } -func LoadResource[T res](fileName string) (T, error) { +func loadResource[T res](fileName string) (T, error) { var result T filePath := fileName if _, err := os.Stat(filePath); !os.IsNotExist(err) { diff --git a/pkg/pipelines/tekton/templates.go b/pkg/pipelines/tekton/templates.go index d7311f8052..5224c32ea2 100644 --- a/pkg/pipelines/tekton/templates.go +++ b/pkg/pipelines/tekton/templates.go @@ -291,7 +291,7 @@ func createAndApplyPipelineTemplate(f fn.Function, namespace string, labels map[ if err != nil { return fmt.Errorf("cannot create tekton client: %w", err) } - pipeline, err := GetPipeline(f) + pipeline, err := getPipeline(f) if err != nil { return fmt.Errorf("cannot generate pipeline: %w", err) } @@ -313,7 +313,7 @@ func createAndApplyPipelineRunTemplate(f fn.Function, namespace string, labels m if err != nil { return err } - piplineRun, err := GetPipelineRun(f) + piplineRun, err := getPipelineRun(f) if err != nil { return fmt.Errorf("cannot generate pipeline run: %w", err) }