Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove unnecessary pointers
  • Loading branch information
kmoe committed Jun 10, 2021
commit cb11377de2df22fe0cc1471d4be292e0d9cc6319
10 changes: 5 additions & 5 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ func (c Config) GetAttribute(ctx context.Context, path *tftypes.AttributePath) (
return nil, fmt.Errorf("error walking config: %w", err)
}

return attrType.ValueFromTerraform(ctx, *attrValue)
return attrType.ValueFromTerraform(ctx, attrValue)
}

func (c Config) terraformValueAtPath(path *tftypes.AttributePath) (*tftypes.Value, error) {
func (c Config) terraformValueAtPath(path *tftypes.AttributePath) (tftypes.Value, error) {
rawValue, remaining, err := tftypes.WalkAttributePath(c.Raw, path)
if err != nil {
return nil, fmt.Errorf("%v still remains in the path: %w", remaining, err)
return tftypes.Value{}, fmt.Errorf("%v still remains in the path: %w", remaining, err)
}
attrValue, ok := rawValue.(tftypes.Value)
if !ok {
return nil, fmt.Errorf("got non-tftypes.Value result %v", rawValue)
return tftypes.Value{}, fmt.Errorf("got non-tftypes.Value result %v", rawValue)
}
return &attrValue, err
return attrValue, err
}
10 changes: 5 additions & 5 deletions plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ func (p Plan) GetAttribute(ctx context.Context, path *tftypes.AttributePath) (at
return nil, fmt.Errorf("error walking plan: %w", err)
}

return attrType.ValueFromTerraform(ctx, *attrValue)
return attrType.ValueFromTerraform(ctx, attrValue)
}

func (p Plan) terraformValueAtPath(path *tftypes.AttributePath) (*tftypes.Value, error) {
func (p Plan) terraformValueAtPath(path *tftypes.AttributePath) (tftypes.Value, error) {
rawValue, remaining, err := tftypes.WalkAttributePath(p.Raw, path)
if err != nil {
return nil, fmt.Errorf("%v still remains in the path: %w", remaining, err)
return tftypes.Value{}, fmt.Errorf("%v still remains in the path: %w", remaining, err)
}
attrValue, ok := rawValue.(tftypes.Value)
if !ok {
return nil, fmt.Errorf("got non-tftypes.Value result %v", rawValue)
return tftypes.Value{}, fmt.Errorf("got non-tftypes.Value result %v", rawValue)
}
return &attrValue, err
return attrValue, err
}
10 changes: 5 additions & 5 deletions state.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ func (s State) GetAttribute(ctx context.Context, path *tftypes.AttributePath) (a
return nil, fmt.Errorf("error walking state: %w", err)
}

return attrType.ValueFromTerraform(ctx, *attrValue)
return attrType.ValueFromTerraform(ctx, attrValue)
}

func (s State) terraformValueAtPath(path *tftypes.AttributePath) (*tftypes.Value, error) {
func (s State) terraformValueAtPath(path *tftypes.AttributePath) (tftypes.Value, error) {
rawValue, remaining, err := tftypes.WalkAttributePath(s.Raw, path)
if err != nil {
return nil, fmt.Errorf("%v still remains in the path: %w", remaining, err)
return tftypes.Value{}, fmt.Errorf("%v still remains in the path: %w", remaining, err)
}
attrValue, ok := rawValue.(tftypes.Value)
if !ok {
return nil, fmt.Errorf("got non-tftypes.Value result %v", rawValue)
return tftypes.Value{}, fmt.Errorf("got non-tftypes.Value result %v", rawValue)
}
return &attrValue, err
return attrValue, err
}