Skip to content

Commit

Permalink
Merge pull request #42 from VinozzZ/fix-type-assertion
Browse files Browse the repository at this point in the history
fix jsonPath implementation
  • Loading branch information
carolynvs authored May 20, 2022
2 parents 107bfae + 81936fc commit e4ff4d3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
22 changes: 11 additions & 11 deletions pkg/az/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (a Action) GetSteps() []builder.ExecutableStep {
// Go doesn't have generics, nothing to see here...
steps := make([]builder.ExecutableStep, len(a.Steps))
for i := range a.Steps {
steps[i] = a.Steps[i]
steps[i] = a.Steps[i].TypedCommand
}

return steps
Expand Down Expand Up @@ -127,7 +127,7 @@ type TypedCommand interface {
builder.SuppressesOutput
}

var _ TypedCommand = UserCommand{}
var _ TypedCommand = &UserCommand{}

type UserCommand struct {
Name string `yaml:"name"`
Expand All @@ -145,23 +145,23 @@ func (s UserCommand) GetWorkingDir() string {
return ""
}

var _ builder.ExecutableStep = UserCommand{}
var _ builder.StepWithOutputs = UserCommand{}
var _ builder.SuppressesOutput = UserCommand{}
var _ builder.ExecutableStep = &UserCommand{}
var _ builder.StepWithOutputs = &UserCommand{}
var _ builder.SuppressesOutput = &UserCommand{}

func (s UserCommand) GetCommand() string {
func (s *UserCommand) GetCommand() string {
return "az"
}

func (s UserCommand) GetArguments() []string {
func (s *UserCommand) GetArguments() []string {
return s.Arguments
}

func (s UserCommand) GetFlags() builder.Flags {
func (s *UserCommand) GetFlags() builder.Flags {
return append(s.Flags, builder.NewFlag("output", "json"))
}

func (s UserCommand) GetOutputs() []builder.Output {
func (s *UserCommand) GetOutputs() []builder.Output {
// Go doesn't have generics, nothing to see here...
outputs := make([]builder.Output, len(s.Outputs))
for i := range s.Outputs {
Expand All @@ -170,11 +170,11 @@ func (s UserCommand) GetOutputs() []builder.Output {
return outputs
}

func (s UserCommand) SuppressesOutput() bool {
func (s *UserCommand) SuppressesOutput() bool {
return s.SuppressOutput
}

func (s UserCommand) SetAction(_ string) {}
func (s *UserCommand) SetAction(_ string) {}

var _ builder.OutputJsonPath = Output{}
var _ builder.OutputFile = Output{}
Expand Down
7 changes: 4 additions & 3 deletions pkg/az/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ var (

// GroupCommand ensures that a group exist or not
type GroupCommand struct {
action string
Name string `yaml:"name"`
Location string `yaml:"location"`
action string
Description string `yaml:"description"`
Name string `yaml:"name"`
Location string `yaml:"location"`
}

func (c *GroupCommand) HandleError(cxt *context.Context, err builder.ExitError, stdout string, stderr string) error {
Expand Down

0 comments on commit e4ff4d3

Please sign in to comment.