summaryrefslogtreecommitdiffstats
path: root/models/release.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/release.go
parent5832f8d90df2d72cb38698c3e9050f2b29717dc7 (diff)
downloadgitea-f9ec2f89f2265bc1371a6c62359de9816534fa6b.tar.gz
gitea-f9ec2f89f2265bc1371a6c62359de9816534fa6b.zip
Add golangci (#6418)
Diffstat (limited to 'models/release.go')
-rw-r--r--models/release.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/models/release.go b/models/release.go
index b7ec4461f2..28a2891013 100644
--- a/models/release.go
+++ b/models/release.go
@@ -50,12 +50,12 @@ func (r *Release) loadAttributes(e Engine) error {
}
}
if r.Publisher == nil {
- r.Publisher, err = GetUserByID(r.PublisherID)
+ r.Publisher, err = getUserByID(e, r.PublisherID)
if err != nil {
return err
}
}
- return GetReleaseAttachments(r)
+ return getReleaseAttachments(e, r)
}
// LoadAttributes load repo and publisher attributes for a release
@@ -316,6 +316,10 @@ func (s releaseMetaSearch) Less(i, j int) bool {
// GetReleaseAttachments retrieves the attachments for releases
func GetReleaseAttachments(rels ...*Release) (err error) {
+ return getReleaseAttachments(x, rels...)
+}
+
+func getReleaseAttachments(e Engine, rels ...*Release) (err error) {
if len(rels) == 0 {
return
}
@@ -335,11 +339,10 @@ func GetReleaseAttachments(rels ...*Release) (err error) {
sort.Sort(sortedRels)
// Select attachments
- err = x.
+ err = e.
Asc("release_id").
In("release_id", sortedRels.ID).
Find(&attachments, Attachment{})
-
if err != nil {
return err
}
@@ -354,7 +357,6 @@ func GetReleaseAttachments(rels ...*Release) (err error) {
}
return
-
}
type releaseSorter struct {
@@ -493,7 +495,7 @@ func SyncReleasesWithTags(repo *Repository, gitRepo *git.Repository) error {
return fmt.Errorf("GetTagCommitID: %v", err)
}
if git.IsErrNotExist(err) || commitID != rel.Sha1 {
- if err := pushUpdateDeleteTag(repo, gitRepo, rel.TagName); err != nil {
+ if err := pushUpdateDeleteTag(repo, rel.TagName); err != nil {
return fmt.Errorf("pushUpdateDeleteTag: %v", err)
}
} else {