Skip to content

Commit

Permalink
refactor: rename -- make functions non-exported
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Vasek <mvasek@redhat.com>
  • Loading branch information
matejvasek committed Oct 25, 2023
1 parent d30b6ae commit d2a227b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions pkg/pipelines/tekton/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/pipelines/tekton/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down

0 comments on commit d2a227b

Please sign in to comment.