github-vet / github-vet/rangeloop-pointer-findings
devdirga/GoHrm: services/remote.go; 47 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#L1905-L1951)
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 1932
[Click here to see the code in its original context.](https://github.com/devdirga/GoHrm/blob/afa43a860afbffa293377313f6bc84a008784f22/services/remote.go#L1905-L1951)
Click here to show the 47 line(s) of Go which triggered the analyzer.
```go
for _, remote := range remotes {
dateCreate = (remote.CreatedAt).Format("2006-01-02 15:04:05")
typeRemoteNum = remote.Type
//reasons = remote.ReasonAction
reasons = note
empName = remote.Name
empEmail = remote.Email
datelist = append(datelist, remote.DateLeave)
if remote.IsRequestChange == true {
isChange = true
if status == "true" {
remote.IsDelete = true
}
remote.IsRequestChange = false
err = repoOrm.Save(&remote)
if err != nil {
return remotes, err
}
layout := "2006-01-02"
t, _ := time.Parse(layout, remote.DateLeave)
//log
emptyleave := new(RequestLeaveModel)
service := LogService{
emptyleave,
&remote,
"remote",
}
log := tk.M{}
if status == "true" {
log.Set("Status", "Cancel")
log.Set("Desc", "Request Remote is Canceled"+" for date "+t.Format("02-Jan-2006"))
} else {
log.Set("Status", "Cancel")
log.Set("Desc", "Request Remote is Declined "+" 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 remotes, 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.