aboutsummaryrefslogtreecommitdiffstats
path: root/models/status.go
diff options
context:
space:
mode:
authorkolaente <konrad@kola-entertainments.de>2019-06-12 21:41:28 +0200
committertechknowlogick <techknowlogick@gitea.io>2019-06-12 15:41:28 -0400
commitf9ec2f89f2265bc1371a6c62359de9816534fa6b (patch)
treef48b138a457e5ac6cf843bbb38400926704370f7 /models/status.go
parent5832f8d90df2d72cb38698c3e9050f2b29717dc7 (diff)
downloadgitea-f9ec2f89f2265bc1371a6c62359de9816534fa6b.tar.gz
gitea-f9ec2f89f2265bc1371a6c62359de9816534fa6b.zip
Add golangci (#6418)
Diffstat (limited to 'models/status.go')
-rw-r--r--models/status.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/models/status.go b/models/status.go
index a3db47f455..384f5693dc 100644
--- a/models/status.go
+++ b/models/status.go
@@ -87,7 +87,7 @@ func (status *CommitStatus) loadRepo(e Engine) (err error) {
// APIURL returns the absolute APIURL to this commit-status.
func (status *CommitStatus) APIURL() string {
- status.loadRepo(x)
+ _ = status.loadRepo(x)
return fmt.Sprintf("%sapi/v1/%s/statuses/%s",
setting.AppURL, status.Repo.FullName(), status.SHA)
}
@@ -95,7 +95,7 @@ func (status *CommitStatus) APIURL() string {
// APIFormat assumes some fields assigned with values:
// Required - Repo, Creator
func (status *CommitStatus) APIFormat() *api.Status {
- status.loadRepo(x)
+ _ = status.loadRepo(x)
apiStatus := &api.Status{
Created: status.CreatedUnix.AsTime(),
Updated: status.CreatedUnix.AsTime(),
@@ -219,7 +219,9 @@ func newCommitStatus(sess *xorm.Session, opts NewCommitStatusOptions) error {
}
has, err := sess.Desc("index").Limit(1).Get(lastCommitStatus)
if err != nil {
- sess.Rollback()
+ if err := sess.Rollback(); err != nil {
+ log.Error("newCommitStatus: sess.Rollback: %v", err)
+ }
return fmt.Errorf("newCommitStatus[%s, %s]: %v", repoPath, opts.SHA, err)
}
if has {
@@ -231,7 +233,9 @@ func newCommitStatus(sess *xorm.Session, opts NewCommitStatusOptions) error {
// Insert new CommitStatus
if _, err = sess.Insert(opts.CommitStatus); err != nil {
- sess.Rollback()
+ if err := sess.Rollback(); err != nil {
+ log.Error("newCommitStatus: sess.Rollback: %v", err)
+ }
return fmt.Errorf("newCommitStatus[%s, %s]: %v", repoPath, opts.SHA, err)
}