aboutsummaryrefslogtreecommitdiffstats
path: root/services/migrations/gogs.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-01-20 18:46:10 +0100
committerGitHub <noreply@github.com>2022-01-20 18:46:10 +0100
commit54e9ee37a7a301dbe74d46fd3c87712e6120e9bf (patch)
tree1be12fb072625c1b896b9d72f7912b018aad502b /services/migrations/gogs.go
parent1d98d205f5825f40110e6628b61a97c91ac7f72d (diff)
downloadgitea-54e9ee37a7a301dbe74d46fd3c87712e6120e9bf.tar.gz
gitea-54e9ee37a7a301dbe74d46fd3c87712e6120e9bf.zip
format with gofumpt (#18184)
* gofumpt -w -l . * gofumpt -w -l -extra . * Add linter * manual fix * change make fmt
Diffstat (limited to 'services/migrations/gogs.go')
-rw-r--r--services/migrations/gogs.go21
1 files changed, 10 insertions, 11 deletions
diff --git a/services/migrations/gogs.go b/services/migrations/gogs.go
index e103ef996e..9280427cd7 100644
--- a/services/migrations/gogs.go
+++ b/services/migrations/gogs.go
@@ -30,8 +30,7 @@ func init() {
}
// GogsDownloaderFactory defines a gogs downloader factory
-type GogsDownloaderFactory struct {
-}
+type GogsDownloaderFactory struct{}
// New returns a Downloader related to this factory according MigrateOptions
func (f *GogsDownloaderFactory) New(ctx context.Context, opts base.MigrateOptions) (base.Downloader, error) {
@@ -81,7 +80,7 @@ func (g *GogsDownloader) SetContext(ctx context.Context) {
// NewGogsDownloader creates a gogs Downloader via gogs API
func NewGogsDownloader(ctx context.Context, baseURL, userName, password, token, repoOwner, repoName string) *GogsDownloader {
- var downloader = GogsDownloader{
+ downloader := GogsDownloader{
ctx: ctx,
baseURL: baseURL,
userName: userName,
@@ -95,7 +94,7 @@ func NewGogsDownloader(ctx context.Context, baseURL, userName, password, token,
client = gogs.NewClient(baseURL, token)
downloader.userName = token
} else {
- var transport = NewMigrationHTTPTransport()
+ transport := NewMigrationHTTPTransport()
transport.Proxy = func(req *http.Request) (*url.URL, error) {
req.SetBasicAuth(userName, password)
return proxy.Proxy()(req)
@@ -139,8 +138,8 @@ func (g *GogsDownloader) GetRepoInfo() (*base.Repository, error) {
// GetMilestones returns milestones
func (g *GogsDownloader) GetMilestones() ([]*base.Milestone, error) {
- var perPage = 100
- var milestones = make([]*base.Milestone, 0, perPage)
+ perPage := 100
+ milestones := make([]*base.Milestone, 0, perPage)
ms, err := g.client.ListRepoMilestones(g.repoOwner, g.repoName)
if err != nil {
@@ -162,8 +161,8 @@ func (g *GogsDownloader) GetMilestones() ([]*base.Milestone, error) {
// GetLabels returns labels
func (g *GogsDownloader) GetLabels() ([]*base.Label, error) {
- var perPage = 100
- var labels = make([]*base.Label, 0, perPage)
+ perPage := 100
+ labels := make([]*base.Label, 0, perPage)
ls, err := g.client.ListRepoLabels(g.repoOwner, g.repoName)
if err != nil {
return nil, err
@@ -203,7 +202,7 @@ func (g *GogsDownloader) GetIssues(page, _ int) ([]*base.Issue, bool, error) {
}
func (g *GogsDownloader) getIssues(page int, state string) ([]*base.Issue, bool, error) {
- var allIssues = make([]*base.Issue, 0, 10)
+ allIssues := make([]*base.Issue, 0, 10)
issues, err := g.client.ListRepoIssues(g.repoOwner, g.repoName, gogs.ListIssueOption{
Page: page,
@@ -225,7 +224,7 @@ func (g *GogsDownloader) getIssues(page int, state string) ([]*base.Issue, bool,
// GetComments returns comments according issueNumber
func (g *GogsDownloader) GetComments(opts base.GetCommentOptions) ([]*base.Comment, bool, error) {
- var allComments = make([]*base.Comment, 0, 100)
+ allComments := make([]*base.Comment, 0, 100)
comments, err := g.client.ListIssueComments(g.repoOwner, g.repoName, opts.Context.ForeignID())
if err != nil {
@@ -276,7 +275,7 @@ func convertGogsIssue(issue *gogs.Issue) *base.Issue {
if issue.Milestone != nil {
milestone = issue.Milestone.Title
}
- var labels = make([]*base.Label, 0, len(issue.Labels))
+ labels := make([]*base.Label, 0, len(issue.Labels))
for _, l := range issue.Labels {
labels = append(labels, convertGogsLabel(l))
}