diff --git a/pkg/buildscript/queries.go b/pkg/buildscript/queries.go index d92c5e4f72..55e07927dc 100644 --- a/pkg/buildscript/queries.go +++ b/pkg/buildscript/queries.go @@ -47,8 +47,8 @@ func (r UnknownRequirement) IsRequirement() {} // Returns the requirements for the given target. // If no target is given, uses the default target (i.e. the name assigned to 'main'). -func (b *BuildScript) Requirements(target ...string) ([]Requirement, error) { - requirementsNode, err := b.getRequirementsNode(target...) +func (b *BuildScript) Requirements(targets ...string) ([]Requirement, error) { + requirementsNode, err := b.getRequirementsNode(targets...) if err != nil { return nil, errs.Wrap(err, "Could not get requirements node") } @@ -99,8 +99,8 @@ func (b *BuildScript) Requirements(target ...string) ([]Requirement, error) { // DependencyRequirements is identical to Requirements except that it only considers dependency type requirements, // which are the most common. // ONLY use this when you know you only need to care about dependencies. -func (b *BuildScript) DependencyRequirements(target ...string) ([]types.Requirement, error) { - reqs, err := b.Requirements(target...) +func (b *BuildScript) DependencyRequirements(targets ...string) ([]types.Requirement, error) { + reqs, err := b.Requirements(targets...) if err != nil { return nil, errs.Wrap(err, "Could not get requirements") } @@ -113,8 +113,8 @@ func (b *BuildScript) DependencyRequirements(target ...string) ([]types.Requirem return deps, nil } -func (b *BuildScript) getRequirementsNode(target ...string) (*Value, error) { - node, err := b.getSolveNode(target...) +func (b *BuildScript) getRequirementsNode(targets ...string) (*Value, error) { + node, err := b.getSolveNode(targets...) if err != nil { return nil, errs.Wrap(err, "Could not get solve node") } @@ -155,14 +155,14 @@ func isSolveFuncName(name string) bool { return name == solveFuncName || name == solveLegacyFuncName } -func (b *BuildScript) getTargetSolveNode(target ...string) (*Value, error) { - if len(target) == 0 { +func (b *BuildScript) getTargetSolveNode(targets ...string) (*Value, error) { + if len(targets) == 0 { for _, assignment := range b.raw.Assignments { if assignment.Key != mainKey { continue } if assignment.Value.Ident != nil && *assignment.Value.Ident != "" { - target = []string{*assignment.Value.Ident} + targets = []string{*assignment.Value.Ident} break } } @@ -177,11 +177,11 @@ func (b *BuildScript) getTargetSolveNode(target ...string) (*Value, error) { continue } - if funk.Contains(target, a.Key) && a.Value.FuncCall != nil { + if funk.Contains(targets, a.Key) && a.Value.FuncCall != nil { return a.Value } - if f := a.Value.FuncCall; len(target) == 0 && f != nil && isSolveFuncName(f.Name) { + if f := a.Value.FuncCall; len(targets) == 0 && f != nil && isSolveFuncName(f.Name) { // This is coming from a complex build expression with no straightforward way to determine // a default target. Fall back on a top-level solve node. return a.Value @@ -202,8 +202,8 @@ func (b *BuildScript) getTargetSolveNode(target ...string) (*Value, error) { return nil, errNodeNotFound } -func (b *BuildScript) getSolveNode(target ...string) (*Value, error) { - node, err := b.getTargetSolveNode(target...) +func (b *BuildScript) getSolveNode(targets ...string) (*Value, error) { + node, err := b.getTargetSolveNode(targets...) if err != nil { return nil, errs.Wrap(err, "Could not get target node") } @@ -237,8 +237,8 @@ func (b *BuildScript) getSolveNode(target ...string) (*Value, error) { return nil, errNodeNotFound } -func (b *BuildScript) getSolveAtTimeValue(target ...string) (*Value, error) { - node, err := b.getSolveNode(target...) +func (b *BuildScript) getSolveAtTimeValue(targets ...string) (*Value, error) { + node, err := b.getSolveNode(targets...) if err != nil { return nil, errs.Wrap(err, "Could not get solve node") } @@ -252,8 +252,8 @@ func (b *BuildScript) getSolveAtTimeValue(target ...string) (*Value, error) { return nil, errValueNotFound } -func (b *BuildScript) Platforms(target ...string) ([]strfmt.UUID, error) { - node, err := b.getPlatformsNode(target...) +func (b *BuildScript) Platforms(targets ...string) ([]strfmt.UUID, error) { + node, err := b.getPlatformsNode(targets...) if err != nil { return nil, errs.Wrap(err, "Could not get platform node") } @@ -265,8 +265,8 @@ func (b *BuildScript) Platforms(target ...string) ([]strfmt.UUID, error) { return list, nil } -func (b *BuildScript) getPlatformsNode(target ...string) (*Value, error) { - node, err := b.getSolveNode(target...) +func (b *BuildScript) getPlatformsNode(targets ...string) (*Value, error) { + node, err := b.getSolveNode(targets...) if err != nil { return nil, errs.Wrap(err, "Could not get solve node") }