Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first
issue it finds, so please do not limit your consideration to the contents of the below message.
function call which takes a reference to c at line 45 may start a goroutine
Click here to show the 24 line(s) of Go which triggered the analyzer.
```go
for i, c := range clusters {
log.WithField("cluster#", i).WithField("field", f).Debug("checking if field was assigned")
if _, assigned := assignedFields[key{idx: i, field: f}]; !assigned {
log.WithField("cluster#", i).WithField("mapstructure_field", f).Debug("field was not assigned")
if reflect.ValueOf(&c).Elem().FieldByName(d.name).CanSet() {
log.WithField("cluster#", i).
WithField("field_name", d.name).
WithField("default_value", d.value).
WithField("can_set", reflect.ValueOf(c).FieldByName(f).CanSet()).
Info("applying default value...")
field := reflect.ValueOf(&c).Elem().FieldByName(d.name)
switch field.Kind() {
case reflect.Bool:
field.SetBool(d.value.(bool))
case reflect.String:
field.SetString(d.value.(string))
default:
return nil, errors.Errorf("unable to assign default values on config clusters: unsupported kind of field: '%s'", field.Kind().String())
}
log.WithField("result", c).Debug("applied default value")
}
}
clusters[i] = c
}
```
Click here to show extra information the analyzer produced.
```
The following paths through the callgraph could lead to a function calling a goroutine:
no paths found; call ended in third-party code; stay tuned for diagnostics
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a Bug :-1:, Mitigated :+1:, or Desirable Behavior :rocket:
See the descriptions of the classifications here for more information.
Found a possible issue in fabric8-services/fabric8-cluster at configuration/decode_clusters.go
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
Click here to see the code in its original context.
Click here to show the 24 line(s) of Go which triggered the analyzer.
```go for i, c := range clusters { log.WithField("cluster#", i).WithField("field", f).Debug("checking if field was assigned") if _, assigned := assignedFields[key{idx: i, field: f}]; !assigned { log.WithField("cluster#", i).WithField("mapstructure_field", f).Debug("field was not assigned") if reflect.ValueOf(&c).Elem().FieldByName(d.name).CanSet() { log.WithField("cluster#", i). WithField("field_name", d.name). WithField("default_value", d.value). WithField("can_set", reflect.ValueOf(c).FieldByName(f).CanSet()). Info("applying default value...") field := reflect.ValueOf(&c).Elem().FieldByName(d.name) switch field.Kind() { case reflect.Bool: field.SetBool(d.value.(bool)) case reflect.String: field.SetString(d.value.(string)) default: return nil, errors.Errorf("unable to assign default values on config clusters: unsupported kind of field: '%s'", field.Kind().String()) } log.WithField("result", c).Debug("applied default value") } } clusters[i] = c } ```Click here to show extra information the analyzer produced.
``` The following paths through the callgraph could lead to a function calling a goroutine: no paths found; call ended in third-party code; stay tuned for diagnostics ```Leave a reaction on this issue to contribute to the project by classifying this instance as a Bug :-1:, Mitigated :+1:, or Desirable Behavior :rocket: See the descriptions of the classifications here for more information.
commit ID: 9b56418804d4b315d72fc42401b2c1270324bcdc