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

k0pernicus/fdcrawler: fdcrawler.go; 30 LoC

Open
#17,175 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 [k0pernicus/fdcrawler](https://www.github.com/k0pernicus/fdcrawler) at [fdcrawler.go](https://github.com/k0pernicus/fdcrawler/blob/b307b0cbd9e1294b04fea6bfa16dcb7e7b21b622/fdcrawler.go#L97-L126)

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 app is reassigned at line 106

[Click here to see the code in its original context.](https://github.com/k0pernicus/fdcrawler/blob/b307b0cbd9e1294b04fea6bfa16dcb7e7b21b622/fdcrawler.go#L97-L126)

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

```go
for _, app := range apps.Applications {
if _, ok := APPS[app.Id]; !ok {
app.PackagesList = make(map[int]bool)
for _, p := range app.Packages {
fmt.Println(p.String())
app.PackagesList[p.Versioncode] = true
// TODO: GoRoutine
go Download(app.Id, p.Apkname, strconv.Itoa(p.Versioncode))
}
APPS[app.Id] = &app
fmt.Printf("[%d] ADDING NEW APP (%s)\n", len(APPS), app.Name)
// app.String()
} else {
if APPS[app.Id].Lastupdated != app.Lastupdated {
for _, _package := range app.Packages {
if _, ok := APPS[app.Id].PackagesList[_package.Versioncode]; !ok {
if err := APPS[app.Id].AddPackage(&_package); err == nil {
// go func() {
// Download(app.Id, _package.Apkname, strconv.Itoa(_package.Versioncode))
// }()
fmt.Printf("ADDING NEW VERSION OF %s: %d\n", app.Id, _package.Versioncode)
} else {
fmt.Println(err)
}
}
}
APPS[app.Id].Lastupdated = app.Lastupdated
}
}
}

```

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

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.