Skip to content

Commit

Permalink
chore: fix flag's data type to string
Browse files Browse the repository at this point in the history
  • Loading branch information
pandatix committed Jan 4, 2024
1 parent 74af4ff commit af8b0d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions internal/provider/challenge/flag_subresource.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ func (data *FlagSubresourceModel) Update(ctx context.Context, diags diag.Diagnos
tflog.Trace(ctx, "updated a flag")

data.Content = types.StringValue(res.Content)
// XXX this should be properly typed
data.Data = types.StringValue(res.Data.(string))
data.Data = types.StringValue(res.Data)

Check failure on line 108 in internal/provider/challenge/flag_subresource.go

View workflow job for this annotation

GitHub Actions / unit-tests (1.21.x, ubuntu-latest)

cannot use res.Data (variable of type any) as string value in argument to types.StringValue: need type assertion
data.Type = types.StringValue(res.Type)
}

Expand Down
5 changes: 2 additions & 3 deletions internal/provider/challenge_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@ func (chall *challengeResourceModel) Read(ctx context.Context, diags diag.Diagno
chall.Flags = append(chall.Flags, challenge.FlagSubresourceModel{
ID: types.StringValue(strconv.Itoa(flag.ID)),
Content: types.StringValue(flag.Content),
// XXX this should be typed properly
Data: types.StringValue(flag.Data.(string)),
Type: types.StringValue(flag.Type),
Data: types.StringValue(flag.Data),
Type: types.StringValue(flag.Type),
})
}

Expand Down

0 comments on commit af8b0d4

Please sign in to comment.