github-vet / github-vet/rangeloop-pointer-findings

badu/gokit-gen: cmd/gokit-gen/main.go; 5 LoC

Open
#16,499 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [badu/gokit-gen](https://www.github.com/badu/gokit-gen) at [cmd/gokit-gen/main.go](https://github.com/badu/gokit-gen/blob/a9ffa04923f3ebc172fb93032f2dec9b97ec54e9/cmd/gokit-gen/main.go#L475-L479)

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 submessage was used in a composite literal at line 477

[Click here to see the code in its original context.](https://github.com/badu/gokit-gen/blob/a9ffa04923f3ebc172fb93032f2dec9b97ec54e9/cmd/gokit-gen/main.go#L475-L479)

Click here to show the 5 line(s) of Go which triggered the analyzer.

```go
for _, submessage := range message.Messages {
if submessage.Name == sk[1] {
return &submessage, nil
}
}

```

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: a9ffa04923f3ebc172fb93032f2dec9b97ec54e9

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with cmd/gokit-gen/main.go at lines 475-479 and review the surrounding lookup logic and the analyzer report. Determine whether returning the referenced range-loop value is a bug, mitigated, or desirable behavior, then apply the issue's requested classification.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.