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

hyeoncheon/uart: actions/apps.go; 8 LoC

Đang mở
#17,841 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
fresh tiny
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
0
Fork
0
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Found a possible issue in [hyeoncheon/uart](https://www.github.com/hyeoncheon/uart) at [actions/apps.go](https://github.com/hyeoncheon/uart/blob/7305ff4e45900d325c8b48c2cf7bbd86e063b243/actions/apps.go#L185-L192)

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/hyeoncheon/uart/blob/7305ff4e45900d325c8b48c2cf7bbd86e063b243/actions/apps.go#L185-L192)

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

```go
for _, role := range *app.GetRoles() {
rolemaps := &[]models.RoleMap{}
tx.Where("role_id = ?", role.ID).All(rolemaps)
for _, rm := range *rolemaps {
c.Logger().Infof("delete rmap %v: %v", rm.ID, tx.Destroy(&rm))
}
c.Logger().Infof("delete role %v: %v", role.ID, tx.Destroy(&role))
}

```

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 {Destroy 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: 7305ff4e45900d325c8b48c2cf7bbd86e063b243

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Đọc actions/apps.go tại các dòng 185-192 trong commit 7305ff4e45900d325c8b48c2cf7bbd86e063b243 và kiểm tra đường dẫn gọi xung quanh để xem xét việc sử dụng con trỏ trong vòng lặp range được báo cáo. Xác định liệu phát hiện của trình phân tích có đại diện cho một lỗi, hành vi đã được giảm thiểu hay hành vi mong muốn, sau đó phân loại issue bằng reaction tương ứng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
go
Lĩnh vực
devtools
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.