Commit 5c039b1
authored
Enable unparam linter and fix issues (#873)
Reference: #865
To reduce potential confusion caused by function signatures.
Previously:
```text
terraform/state.go:387:30: `(*State).removeModule` - `path` is unused (unparam)
func (s *State) removeModule(path []string, v *ModuleState) {
^
terraform/state.go:415:32: `(*State).removeInstance` - `path` is unused (unparam)
func (s *State) removeInstance(path []string, r *ResourceState, v *InstanceState) {
^
helper/resource/testing.go:549:58: Test$1 - result 1 (error) is always nil (unparam)
c.ProviderFactories[name] = func() (*schema.Provider, error) {
^
helper/resource/testing.go:1007:33: `modulePrimaryInstanceState` - `s` is unused (unparam)
func modulePrimaryInstanceState(s *terraform.State, ms *terraform.ModuleState, name string) (*terraform.InstanceState, error) {
^
helper/resource/testing_test.go:39:21: TestTest_factoryError$1 - result 0 (*github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.Provider) is always nil (unparam)
factory := func() (*schema.Provider, error) {
^
helper/schema/field_reader.go:174:32: `readListField` - `schema` is unused (unparam)
r FieldReader, addr []string, schema *Schema) (FieldReadResult, error) {
^
helper/schema/field_reader_config_test.go:538:17: `testConfig` - `t` is unused (unparam)
func testConfig(t *testing.T, raw map[string]interface{}) *terraform.ResourceConfig {
^
helper/schema/field_writer_map.go:118:2: `(*MapFieldWriter).setList` - `schema` is unused (unparam)
schema *Schema) error {
^
helper/schema/field_writer_map.go:164:2: `(*MapFieldWriter).setMap` - `schema` is unused (unparam)
schema *Schema) error {
^
helper/schema/field_writer_map.go:211:2: `(*MapFieldWriter).setObject` - `schema` is unused (unparam)
schema *Schema) error {
^
helper/schema/grpc_provider.go:359:50: `(*GRPCProviderServer).upgradeFlatmapState` - `ctx` is unused (unparam)
func (s *GRPCProviderServer) upgradeFlatmapState(ctx context.Context, version int, m map[string]string, res *Resource) (map[string]interface{}, int, error) {
^
helper/schema/resource.go:853:47: `isReservedResourceFieldName` - `s` is unused (unparam)
func isReservedResourceFieldName(name string, s *Schema) bool {
^
helper/schema/resource_diff_test.go:41:34: `testDiffCases` - `oldPrefix` is unused (unparam)
func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) []resourceDiffTestCase {
^
helper/schema/resource_test.go:557:38: `TestResourceApply_isNewResource$1` - `m` is unused (unparam)
updateFunc := func(d *ResourceData, m interface{}) error {
```1 parent dfcf7bc commit 5c039b1
File tree
14 files changed
+30
-32
lines changed- helper
- resource
- schema
- terraform
14 files changed
+30
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
546 | 546 | | |
547 | 547 | | |
548 | 548 | | |
549 | | - | |
| 549 | + | |
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
| |||
1004 | 1004 | | |
1005 | 1005 | | |
1006 | 1006 | | |
1007 | | - | |
| 1007 | + | |
1008 | 1008 | | |
1009 | 1009 | | |
1010 | 1010 | | |
| |||
1026 | 1026 | | |
1027 | 1027 | | |
1028 | 1028 | | |
1029 | | - | |
| 1029 | + | |
1030 | 1030 | | |
1031 | 1031 | | |
1032 | 1032 | | |
1033 | 1033 | | |
1034 | 1034 | | |
1035 | 1035 | | |
1036 | | - | |
| 1036 | + | |
1037 | 1037 | | |
1038 | 1038 | | |
1039 | 1039 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
| 174 | + | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
| 261 | + | |
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
536 | 536 | | |
537 | 537 | | |
538 | 538 | | |
| 539 | + | |
539 | 540 | | |
540 | 541 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | | - | |
| 117 | + | |
119 | 118 | | |
120 | 119 | | |
121 | 120 | | |
| |||
160 | 159 | | |
161 | 160 | | |
162 | 161 | | |
163 | | - | |
164 | | - | |
| 162 | + | |
165 | 163 | | |
166 | 164 | | |
167 | 165 | | |
| |||
207 | 205 | | |
208 | 206 | | |
209 | 207 | | |
210 | | - | |
211 | | - | |
| 208 | + | |
212 | 209 | | |
213 | 210 | | |
214 | 211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
| 358 | + | |
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
| |||
0 commit comments