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

bertzzie/obrolansubuh-backend: app/controllers/post.go; 17 LoC

Open
#16,350 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 [bertzzie/obrolansubuh-backend](https://www.github.com/bertzzie/obrolansubuh-backend) at [app/controllers/post.go](https://github.com/bertzzie/obrolansubuh-backend/blob/b42adc5e3172ebcbf94837cb9c577cf551b56a1d/app/controllers/post.go#L107-L123)

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/bertzzie/obrolansubuh-backend/blob/b42adc5e3172ebcbf94837cb9c577cf551b56a1d/app/controllers/post.go#L107-L123)

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

```go
for _, post := range posts {
var cat models.Category
c.Trx.Model(&post).Association("Categories").Find(&cat)

tmp := PostList{
ID: post.ID,
Title: post.Title,
Author: post.Author.Name,
Category: cat.Heading,
Content: post.Content,
CreatedAt: post.CreatedAt,
Published: post.Published,
EditLink: routes.Post.Edit(post.ID),
ToggleLink: routes.Post.TogglePublished(post.ID),
}
postList = append(postList, tmp)
}

```

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 {Model 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: b42adc5e3172ebcbf94837cb9c577cf551b56a1d

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.