Skip to content

Commit 25a74f4

Browse files
committed
at least the linter will be happy
1 parent e3492d1 commit 25a74f4

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

internal/command/arguments/state_show_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ func TestParseStateShow_valid(t *testing.T) {
1717
"address only": {
1818
[]string{"test_instance.foo"},
1919
&StateShow{
20-
Address: "test_instance.foo",
20+
Address: "test_instance.foo",
21+
ViewType: ViewHuman,
2122
},
2223
},
2324
"with state path": {
2425
[]string{"-state=foobar.tfstate", "test_instance.foo"},
2526
&StateShow{
2627
StatePath: "foobar.tfstate",
2728
Address: "test_instance.foo",
29+
ViewType: ViewHuman,
2830
},
2931
},
3032
}
@@ -50,7 +52,7 @@ func TestParseStateShow_invalid(t *testing.T) {
5052
}{
5153
"no arguments": {
5254
nil,
53-
&StateShow{},
55+
&StateShow{ViewType: ViewHuman},
5456
tfdiags.Diagnostics{
5557
tfdiags.Sourceless(
5658
tfdiags.Error,
@@ -62,7 +64,8 @@ func TestParseStateShow_invalid(t *testing.T) {
6264
"too many arguments": {
6365
[]string{"test_instance.foo", "test_instance.bar"},
6466
&StateShow{
65-
Address: "test_instance.foo",
67+
Address: "test_instance.foo",
68+
ViewType: ViewHuman,
6669
},
6770
tfdiags.Diagnostics{
6871
tfdiags.Sourceless(
@@ -74,7 +77,7 @@ func TestParseStateShow_invalid(t *testing.T) {
7477
},
7578
"unknown flag": {
7679
[]string{"-boop"},
77-
&StateShow{},
80+
&StateShow{ViewType: ViewHuman},
7881
tfdiags.Diagnostics{
7982
tfdiags.Sourceless(
8083
tfdiags.Error,

internal/command/state_show.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ func (c *StateShowCommand) Run(args []string) int {
131131

132132
state := stateMgr.State()
133133
if state == nil {
134-
diags = diags.Append(fmt.Errorf(errStateNotFound))
134+
diags = diags.Append(errStateNotFound)
135135
view.Diagnostics(diags)
136136
return 1
137137
}
138138

139139
is := state.ResourceInstance(addr)
140140
if !is.HasCurrent() {
141-
diags = diags.Append(fmt.Errorf(errNoInstanceFound))
141+
diags = diags.Append(errNoInstanceFound)
142142
view.Diagnostics(diags)
143143
return 1
144144
}

internal/command/views/show.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,6 @@ func (v *ShowJSON) DisplayResourceInstanceState(rs *states.Resource, rAddr addrs
191191
v.view.streams.Eprintf("JSON parse error: %s", err)
192192
return 1
193193
}
194-
v.view.streams.Println(string(prettyJSON.Bytes()))
194+
v.view.streams.Println(prettyJSON.String())
195195
return 0
196196
}

0 commit comments

Comments
 (0)