github-vet / github-vet/rangeloop-pointer-findings
aclisp/sims: pkg/go-micro/runtime/kubernetes/kubernetes.go; 30 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [aclisp/sims](https://www.github.com/aclisp/sims) at [pkg/go-micro/runtime/kubernetes/kubernetes.go](https://github.com/aclisp/sims/blob/34efcbfc99c46b37af232f31f21cda26deb42321/pkg/go-micro/runtime/kubernetes/kubernetes.go#L107-L136)
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.
> reference to kservice was used in a composite literal at line 119
[Click here to see the code in its original context.](https://github.com/aclisp/sims/blob/34efcbfc99c46b37af232f31f21cda26deb42321/pkg/go-micro/runtime/kubernetes/kubernetes.go#L107-L136)
Click here to show the 30 line(s) of Go which triggered the analyzer.
```go
for _, kservice := range serviceList.Items {
// name of the service
name := kservice.Metadata.Labels["name"]
// version of the service
version := kservice.Metadata.Labels["version"]
srv := &service{
Service: &runtime.Service{
Name: name,
Version: version,
Metadata: make(map[string]string),
},
kservice: &kservice,
}
// set the address
address := kservice.Spec.ClusterIP
port := kservice.Spec.Ports[0]
srv.Service.Metadata["address"] = fmt.Sprintf("%s:%d", address, port.Port)
// set the type of service
srv.Service.Metadata["type"] = kservice.Metadata.Labels["micro"]
// copy annotations metadata into service metadata
for k, v := range kservice.Metadata.Annotations {
srv.Service.Metadata[k] = v
}
// save as service
svcMap[name+version] = srv
}
```
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](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 34efcbfc99c46b37af232f31f21cda26deb42321
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.