github-vet / github-vet/rangeloop-pointer-findings
goharbor/harbor: src/controller/event/handler/util/util.go; 20 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [goharbor/harbor](https://www.github.com/goharbor/harbor) at [src/controller/event/handler/util/util.go](https://github.com/goharbor/harbor/blob/bd46af691c1c977f50dc3f0b12f9f381cb9e07ae/src/controller/event/handler/util/util.go#L25-L44)
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 target was used in a composite literal at line 31
[Click here to see the code in its original context.](https://github.com/goharbor/harbor/blob/bd46af691c1c977f50dc3f0b12f9f381cb9e07ae/src/controller/event/handler/util/util.go#L25-L44)
Click here to show the 20 line(s) of Go which triggered the analyzer.
```go
for _, target := range targets {
evt := &event.Event{}
hookMetadata := &event.HookMetaData{
EventType: eventType,
PolicyID: ply.ID,
Payload: payload,
Target: &target,
}
// It should never affect evaluating other policies when one is failed, but error should return
if err := evt.Build(hookMetadata); err == nil {
if err := evt.Publish(); err != nil {
errRet = true
log.Errorf("failed to publish hook notify event: %v", err)
}
} else {
errRet = true
log.Errorf("failed to build hook notify event metadata: %v", err)
}
log.Debugf("published image event %s by topic %s", payload.Type, target.Type)
}
```
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: bd46af691c1c977f50dc3f0b12f9f381cb9e07ae
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.