github-vet / github-vet/rangeloop-pointer-findings
techknowlogick/shiori: cmd/serve/web-handler-api.go; 48 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [techknowlogick/shiori](https://www.github.com/techknowlogick/shiori) at [cmd/serve/web-handler-api.go](https://github.com/techknowlogick/shiori/blob/bdd46bc07b2df7251066579eec41a31bf16932fd/cmd/serve/web-handler-api.go#L337-L384)
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.
>
[Click here to see the code in its original context.](https://github.com/techknowlogick/shiori/blob/bdd46bc07b2df7251066579eec41a31bf16932fd/cmd/serve/web-handler-api.go#L337-L384)
Click here to show the 48 line(s) of Go which triggered the analyzer.
```go
for _, book := range books {
wg.Add(1)
go func(book *model.Bookmark) {
// Make sure to stop wait group
defer wg.Done()
// Parse URL
parsedURL, err := nurl.Parse(book.URL)
if err != nil || !valid.IsRequestURL(book.URL) {
return
}
// Fetch data from internet
article, err := readability.FromURL(parsedURL.String(), 20*time.Second)
if err != nil {
return
}
book.Excerpt = article.Excerpt
book.Author = article.Byline
book.MinReadTime = int(math.Floor(float64(article.Length)/(987+188) + 0.5))
book.MaxReadTime = int(math.Floor(float64(article.Length)/(987-188) + 0.5))
book.Content = article.TextContent
book.HTML = article.Content
// Make sure title is not empty
if article.Title != "" {
book.Title = article.Title
}
// Check if book has content
if book.Content != "" {
book.HasContent = true
}
// Update bookmark image in local disk
u2, err := uuid.NewV4()
if err != nil {
utils.CheckError(err)
}
imgPath := fp.Join(h.dataDir, "thumb", u2.String())
err = downloadFile(article.Image, imgPath, 20*time.Second)
if err == nil {
book.ImageURL = fmt.Sprintf("/thumb/%s", u2)
}
}(&book)
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature { 1} was not found in the callgraph; reference was passed directly to third-party code
```
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: bdd46bc07b2df7251066579eec41a31bf16932fd
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.