github-vet / github-vet/rangeloop-pointer-findings
mozilla/pd-cli: command/repo/initrepo.go; 22 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [mozilla/pd-cli](https://www.github.com/mozilla/pd-cli) at [command/repo/initrepo.go](https://github.com/mozilla/pd-cli/blob/e7c26d89b80ef53ff5e2bdce60f266e5d7c6044a/command/repo/initrepo.go#L55-L76)
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 name was used in a composite literal at line 60
[Click here to see the code in its original context.](https://github.com/mozilla/pd-cli/blob/e7c26d89b80ef53ff5e2bdce60f266e5d7c6044a/command/repo/initrepo.go#L55-L76)
Click here to show the 22 line(s) of Go which triggered the analyzer.
```go
for name, color := range labels {
// check if the label exists
_ = color
label, resp, err := ghClient.Issues.GetLabel(ctx, owner, repo, name)
if err != nil && resp.StatusCode == http.StatusNotFound {
label := &github.Label{Name: &name, Color: &color}
_, _, err := ghClient.Issues.CreateLabel(ctx, owner, repo, label)
if err != nil {
fmt.Fprintf(outError, " - Error: Creating label %s\n", name)
continue
} else {
fmt.Fprintf(outError, " - Created label %s\n", name)
}
} else if *label.Color != color {
_, _, err := ghClient.Issues.EditLabel(ctx, owner, repo, name, &github.Label{Color: &color})
if err != nil {
fmt.Fprintf(outError, " - Error: changing color for %s\n", name)
} else {
fmt.Fprintf(outInfo, " - Changed color for label %s to %s\n", name, color)
}
}
}
```
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: e7c26d89b80ef53ff5e2bdce60f266e5d7c6044a
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.