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

buglloc/http-nose: httpfeature/multiline_headers_continuation.go; 22 LoC

Open
#15,204 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [buglloc/http-nose](https://www.github.com/buglloc/http-nose) at [httpfeature/multiline_headers_continuation.go](https://github.com/buglloc/http-nose/blob/27368bc6789e10a3569c34b402e57cfff7bbde3f/httpfeature/multiline_headers_continuation.go#L33-L54)

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.

> range-loop variable c used in defer or goroutine at line 39

[Click here to see the code in its original context.](https://github.com/buglloc/http-nose/blob/27368bc6789e10a3569c34b402e57cfff7bbde3f/httpfeature/multiline_headers_continuation.go#L33-L54)

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

```go
for _, c := range NotAlphaNumSyms {
sem <- true
go func(sym rune) {
defer func() { <-sem }()
req := f.BaseRequest.Clone()

req.AddHeader("X-Multiline-Test", fmt.Sprintf("test\r\n%cmultiline", c))
resp, err := f.Client.MakeRequest(req)
if err != nil || resp.Status != 200 {
return
}

for _, h := range resp.HeadersSlice("X-Multiline-Test") {
if strings.HasPrefix(h.Value, "test") && strings.HasSuffix(h.Value, "multiline") {
mu.Lock()
f.Symbols = append(f.Symbols, sym)
mu.Unlock()
break
}
}
}(c)
}

```

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: 27368bc6789e10a3569c34b402e57cfff7bbde3f

Contributor guide

No contributing guide indexed for this repository

Research direction

Read httpfeature/multiline_headers_continuation.go at lines 33-54 and inspect the complete closure and range-loop context around the reported warning. Determine whether the captured loop variable represents a bug, mitigated behavior, or desirable behavior, then leave the corresponding reaction on the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.