github-vet / github-vet/rangeloop-pointer-findings
aws/amazon-sagemaker-operator-for-k8s: smlogs-kubectl-plugin/pkg/cmd/smlogs.go; 17 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [aws/amazon-sagemaker-operator-for-k8s](https://www.github.com/aws/amazon-sagemaker-operator-for-k8s) at [smlogs-kubectl-plugin/pkg/cmd/smlogs.go](https://github.com/aws/amazon-sagemaker-operator-for-k8s/blob/ebcd3e3b9e339fd95426ae6fe81477e2a4890763/smlogs-kubectl-plugin/pkg/cmd/smlogs.go#L358-L374)
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 event is reassigned at line 360
[Click here to see the code in its original context.](https://github.com/aws/amazon-sagemaker-operator-for-k8s/blob/ebcd3e3b9e339fd95426ae6fe81477e2a4890763/smlogs-kubectl-plugin/pkg/cmd/smlogs.go#L358-L374)
Click here to show the 17 line(s) of Go which triggered the analyzer.
```go
for _, event := range filterResponse.Events[startingIndex:] {
latestEvent = &event
// time.Unix only accepts in seconds or nanoseconds, Timestamp is in milliseconds
timestampInNano := *event.Timestamp * 1e6
utcTimestamp := time.Unix(0, timestampInNano)
// TODO would be great to have customization of which fields to show
// For example, we should show LogStreamName if they use multiple worker instances.
// They may or may not want IngestionTime as well.
if o.hideLogStreamName {
fmt.Fprintf(o.Out, "%s %s\n", utcTimestamp, *event.Message)
} else {
fmt.Fprintf(o.Out, "%s %s %s\n", *event.LogStreamName, utcTimestamp, *event.Message)
}
}
```
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: ebcd3e3b9e339fd95426ae6fe81477e2a4890763
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.