packer-cn/packer/artifact_test.go
Wilken Rivera b9f1b3c8d4
Fix gosimple S1005 linting issue (#8870)
Results before change
```
⇶  golangci-lint run ./... --disable-all --enable=gosimple | grep 1005
fix/fixer_comm_config.go:48:4: S1005: should write `sshHostPortMinRaw := builders["ssh_host_port_min"]` instead of `sshHostPortMinRaw, _ := builders["ssh_host_port_min"]` (gosimple)
fix/fixer_comm_config.go:64:4: S1005: should write `sshHostPortMaxRaw := builders["ssh_host_port_max"]` instead of `sshHostPortMaxRaw, _ := builders["ssh_host_port_max"]` (gosimple)
fix/fixer_comm_config.go:81:4: S1005: should write `sshSkipNatMappingRaw := builders["ssh_skip_nat_mapping"]` instead of `sshSkipNatMappingRaw, _ := builders["ssh_skip_nat_mapping"]` (gosimple)
packer/artifact_mock.go:47:2: S1005: should write `value := a.StateValues[name]` instead of `value, _ := a.StateValues[name]` (gosimple)
packer/artifact_test.go:31:2: S1005: should write `value := a.state[name]` instead of `value, _ := a.state[name]` (gosimple)
```

Results after change
```
```
2020-03-11 10:30:08 +01:00

39 lines
584 B
Go

package packer
type TestArtifact struct {
id string
state map[string]interface{}
destroyCalled bool
}
func (*TestArtifact) BuilderId() string {
return "bid"
}
func (*TestArtifact) Files() []string {
return []string{"a", "b"}
}
func (a *TestArtifact) Id() string {
id := a.id
if id == "" {
id = "id"
}
return id
}
func (*TestArtifact) String() string {
return "string"
}
func (a *TestArtifact) State(name string) interface{} {
value := a.state[name]
return value
}
func (a *TestArtifact) Destroy() error {
a.destroyCalled = true
return nil
}