github-vet / github-vet/rangeloop-pointer-findings
devdirga/GoHrm: services/remote.go; 42 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [devdirga/GoHrm](https://www.github.com/devdirga/GoHrm) at [services/remote.go](https://github.com/devdirga/GoHrm/blob/afa43a860afbffa293377313f6bc84a008784f22/services/remote.go#L191-L232)
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 remote was used in a composite literal at line 214
[Click here to see the code in its original context.](https://github.com/devdirga/GoHrm/blob/afa43a860afbffa293377313f6bc84a008784f22/services/remote.go#L191-L232)
Click here to show the 42 line(s) of Go which triggered the analyzer.
```go
for _, remote := range remotes {
dateCreate = (remote.CreatedAt).Format("2006-01-02 15:04:05")
typeRemote = remote.Type
remote.IsRequestChange = true
remote.ReasonAction = reason
// tk.Println("---------------- level ", level)
if level == 5 || level == 1 {
remote.IsDelete = true
} else if level == 6 {
remote.IsDelete = true
}
err := repoOrm.Save(&remote)
if err != nil {
return err
}
layout := "2006-01-02"
t, _ := time.Parse(layout, remote.DateLeave)
//log
emptyleave := new(RequestLeaveModel)
service := LogService{
emptyleave,
&remote,
"remote",
}
log := tk.M{}
if level == 5 || level == 1 || level == 6 {
log.Set("Status", "Cancel")
log.Set("Desc", "Request Remote Canceled"+" for date "+t.Format("02-Jan-2006"))
} else {
log.Set("Status", "Request Cancel")
log.Set("Desc", "Employee Request Cancel Remote"+" for date "+t.Format("02-Jan-2006"))
}
log.Set("NameLogBy", user.Fullname)
log.Set("EmailNameLogBy", user.Email)
err = service.CancelRequest(log)
if err != nil {
return err
}
}
```
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: afa43a860afbffa293377313f6bc84a008784f22
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.