Skip to content

Commit

Permalink
refactor: naming yamlPathEvaluator struct
Browse files Browse the repository at this point in the history
  • Loading branch information
deryrahman committed Oct 13, 2023
1 parent 3ad94f3 commit 7cea421
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plugin/upstream_identifier/evaluator/yamlpath_evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/goto/optimus/internal/errors"
)

type yamlpathEvaluator struct {
type yamlPathEvaluator struct {
logger log.Logger
filepath string
pathSelector *yamlpath.Path
Expand All @@ -21,7 +21,7 @@ type yamlpathEvaluator struct {
// Evaluator returns the rawResource eg. query string given assets
// it returns whatever inside the defined filepath and its selector
// valid selector is defined from this BNF https://github.com/vmware-labs/yaml-jsonpath#syntax
func (e yamlpathEvaluator) Evaluate(assets map[string]string) string {
func (e yamlPathEvaluator) Evaluate(assets map[string]string) string {
cleanedFilePath := filepath.Base(e.filepath)
raw, ok := assets[cleanedFilePath]
if !ok {
Expand All @@ -47,7 +47,7 @@ func (e yamlpathEvaluator) Evaluate(assets map[string]string) string {
return strings.Join(values, "\n")
}

func (e yamlpathEvaluator) extractValue(value string, assets map[string]string) string {
func (e yamlPathEvaluator) extractValue(value string, assets map[string]string) string {

Check failure on line 50 in plugin/upstream_identifier/evaluator/yamlpath_evaluator.go

View workflow job for this annotation

GitHub Actions / lint

unused-receiver: method receiver 'e' is not referenced in method's body, consider removing or renaming it as _ (revive)
// heuristically value can potentially be a filepath if there's no spaces
if !strings.Contains(value, " ") {
cleanedFilePath := filepath.Base(value)
Expand All @@ -58,7 +58,7 @@ func (e yamlpathEvaluator) extractValue(value string, assets map[string]string)
return value
}

func newYamlPathEvaluator(logger log.Logger, filepath, selector string) (*yamlpathEvaluator, error) {
func newYamlPathEvaluator(logger log.Logger, filepath, selector string) (*yamlPathEvaluator, error) {
me := errors.NewMultiError("create jsonpath evaluator errors")
if logger == nil {
me.Append(fmt.Errorf("logger is nil"))
Expand All @@ -77,7 +77,7 @@ func newYamlPathEvaluator(logger log.Logger, filepath, selector string) (*yamlpa
return nil, me.ToErr()
}

return &yamlpathEvaluator{
return &yamlPathEvaluator{
logger: logger,
filepath: filepath,
pathSelector: pathSelector,
Expand Down

0 comments on commit 7cea421

Please sign in to comment.