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

wakatara/harsh: harsh.go; 6 LoC

Open
#10,692 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 [wakatara/harsh](https://www.github.com/wakatara/harsh) at [harsh.go](https://github.com/wakatara/harsh/blob/154be2afec85f5eb30f6de6eaea765d3a66fa760/harsh.go#L113-L118)

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

[Click here to see the code in its original context.](https://github.com/wakatara/harsh/blob/154be2afec85f5eb30f6de6eaea765d3a66fa760/harsh.go#L113-L118)

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

```go
for _, habit := range habits {
consistency[habit.Name] = append(consistency[habit.Name], buildGraph(&habit, *entries, firstRecord[habit], from, to))
fmt.Printf("%25v", habit.Name+" ")
fmt.Printf(strings.Join(consistency[habit.Name], ""))
fmt.Printf("\n")
}

```

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: 154be2afec85f5eb30f6de6eaea765d3a66fa760

Contributor guide

No contributing guide indexed for this repository

Research direction

Read harsh.go lines 113-118 and the surrounding code to understand how the range-loop variable is referenced in the composite call. Decide whether the analyzer finding represents a bug, mitigated behavior, or desirable behavior, then record that classification using the corresponding issue reaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.