diff options
author | Gusted <williamzijl7@hotmail.com> | 2021-12-20 05:41:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-20 04:41:31 +0000 |
commit | ff2fd08228dd6323ac4a1cbd2f37f8ae15733eab (patch) | |
tree | 9079b869968d358502f64ce03caf4097556c53cd /modules/context | |
parent | 25677cdc5b11f7100ca2e4b0819e02ca62e22ab1 (diff) | |
download | gitea-ff2fd08228dd6323ac4a1cbd2f37f8ae15733eab.tar.gz gitea-ff2fd08228dd6323ac4a1cbd2f37f8ae15733eab.zip |
Simplify parameter types (#18006)
Remove repeated type declarations in function definitions.
Diffstat (limited to 'modules/context')
-rw-r--r-- | modules/context/pagination.go | 6 | ||||
-rw-r--r-- | modules/context/repo.go | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/modules/context/pagination.go b/modules/context/pagination.go index b678fccd15..107cbf6186 100644 --- a/modules/context/pagination.go +++ b/modules/context/pagination.go @@ -20,14 +20,14 @@ type Pagination struct { } // NewPagination creates a new instance of the Pagination struct -func NewPagination(total int, page int, issueNum int, numPages int) *Pagination { +func NewPagination(total, page, issueNum, numPages int) *Pagination { p := &Pagination{} p.Paginater = paginater.New(total, page, issueNum, numPages) return p } // AddParam adds a value from context identified by ctxKey as link param under a given paramKey -func (p *Pagination) AddParam(ctx *Context, paramKey string, ctxKey string) { +func (p *Pagination) AddParam(ctx *Context, paramKey, ctxKey string) { _, exists := ctx.Data[ctxKey] if !exists { return @@ -38,7 +38,7 @@ func (p *Pagination) AddParam(ctx *Context, paramKey string, ctxKey string) { } // AddParamString adds a string parameter directly -func (p *Pagination) AddParamString(key string, value string) { +func (p *Pagination) AddParamString(key, value string) { urlParam := fmt.Sprintf("%s=%v", url.QueryEscape(key), url.QueryEscape(value)) p.urlParams = append(p.urlParams, urlParam) } diff --git a/modules/context/repo.go b/modules/context/repo.go index 139dfaf0f8..e259168d56 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -180,7 +180,7 @@ func (r *Repository) GetCommitsCount() (int64, error) { } // GetCommitGraphsCount returns cached commit count for current view -func (r *Repository) GetCommitGraphsCount(hidePRRefs bool, branches []string, files []string) (int64, error) { +func (r *Repository) GetCommitGraphsCount(hidePRRefs bool, branches, files []string) (int64, error) { cacheKey := fmt.Sprintf("commits-count-%d-graph-%t-%s-%s", r.Repository.ID, hidePRRefs, branches, files) return cache.GetInt64(cacheKey, func() (int64, error) { @@ -206,7 +206,7 @@ func (r *Repository) BranchNameSubURL() string { } // FileExists returns true if a file exists in the given repo branch -func (r *Repository) FileExists(path string, branch string) (bool, error) { +func (r *Repository) FileExists(path, branch string) (bool, error) { if branch == "" { branch = r.Repository.DefaultBranch } |