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

volution/kawipiko: sources/cmd/server/server.go; 27 LoC

Open
#9,105 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 [volution/kawipiko](https://www.github.com/volution/kawipiko) at [sources/cmd/server/server.go](https://github.com/volution/kawipiko/blob/8414abdbba44347572f9ac6a0448b4a061667d37/sources/cmd/server/server.go#L774-L800)

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 _processIndex used in defer or goroutine at line 794

[Click here to see the code in its original context.](https://github.com/volution/kawipiko/blob/8414abdbba44347572f9ac6a0448b4a061667d37/sources/cmd/server/server.go#L774-L800)

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

```go
for _processIndex, _ := range _processesPid {
_processArguments := append ([]string { _processName, "--slave", fmt.Sprintf ("%d", _processIndex + 1) }, _processArguments ...)
if _processPid, _error := os.StartProcess (_processName, _processArguments, _processAttributes); _error == nil {
_processesJoin.Add (1)
_processesPid[_processIndex] = _processPid
if !_quiet {
log.Printf ("[ii] [63cb22f8] sub-process `%d` started (with `%d` threads);\n", _processPid.Pid, _threads)
}
go func (_index int, _processPid *os.Process) () {
if _processStatus, _error := _processPid.Wait (); _error == nil {
if _processStatus.Success () {
if _debug {
log.Printf ("[ii] [66b60b81] sub-process `%d` succeeded;\n", _processPid.Pid)
}
} else {
log.Printf ("[ww] [5d25046b] sub-process `%d` failed: `%s`; ignoring!\n", _processPid.Pid, _processStatus)
}
} else {
LogError (_error, fmt.Sprintf ("[f1bfc927] failed waiting for sub-process `%d`; ignoring!", _processPid.Pid))
}
_processesPid[_processIndex] = nil
_processesJoin.Done ()
} (_processIndex, _processPid)
} else {
LogError (_error, "[8892b34d] failed starting sub-process; ignoring!")
}
}

```

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: 8414abdbba44347572f9ac6a0448b4a061667d37

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.