summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2021-12-20 05:41:31 +0100
committerGitHub <noreply@github.com>2021-12-20 04:41:31 +0000
commitff2fd08228dd6323ac4a1cbd2f37f8ae15733eab (patch)
tree9079b869968d358502f64ce03caf4097556c53cd /modules
parent25677cdc5b11f7100ca2e4b0819e02ca62e22ab1 (diff)
downloadgitea-ff2fd08228dd6323ac4a1cbd2f37f8ae15733eab.tar.gz
gitea-ff2fd08228dd6323ac4a1cbd2f37f8ae15733eab.zip
Simplify parameter types (#18006)
Remove repeated type declarations in function definitions.
Diffstat (limited to 'modules')
-rw-r--r--modules/avatar/identicon/block.go60
-rw-r--r--modules/avatar/identicon/polygon.go2
-rw-r--r--modules/base/tool.go2
-rw-r--r--modules/charset/charset_test.go6
-rw-r--r--modules/context/pagination.go6
-rw-r--r--modules/context/repo.go4
-rw-r--r--modules/eventsource/event.go2
-rw-r--r--modules/git/repo.go4
-rw-r--r--modules/git/repo_commit.go4
-rw-r--r--modules/git/repo_compare.go2
-rw-r--r--modules/git/repo_tree.go2
-rw-r--r--modules/git/utils.go2
-rw-r--r--modules/gitgraph/graph.go2
-rw-r--r--modules/hostmatcher/hostmatcher.go4
-rw-r--r--modules/hostmatcher/http.go2
-rw-r--r--modules/log/multichannel.go2
-rw-r--r--modules/log/writer.go2
-rw-r--r--modules/markup/markdown/goldmark.go2
-rw-r--r--modules/notification/action/action.go2
-rw-r--r--modules/notification/base/null.go4
-rw-r--r--modules/notification/indexer/indexer.go2
-rw-r--r--modules/notification/notification.go4
-rw-r--r--modules/notification/webhook/webhook.go4
-rw-r--r--modules/references/references.go6
-rw-r--r--modules/secret/secret.go4
-rw-r--r--modules/setting/log.go4
-rw-r--r--modules/setting/setting.go4
-rw-r--r--modules/ssh/ssh.go2
-rw-r--r--modules/templates/helper.go4
-rw-r--r--modules/upload/upload.go2
-rw-r--r--modules/util/compare.go2
-rw-r--r--modules/util/path.go2
-rw-r--r--modules/web/middleware/cookie.go2
-rw-r--r--modules/web/route.go2
34 files changed, 80 insertions, 80 deletions
diff --git a/modules/avatar/identicon/block.go b/modules/avatar/identicon/block.go
index b8eed5895e..249a3e0958 100644
--- a/modules/avatar/identicon/block.go
+++ b/modules/avatar/identicon/block.go
@@ -16,10 +16,10 @@ var (
blocks = []blockFunc{b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27}
)
-type blockFunc func(img *image.Paletted, x, y, size int, angle int)
+type blockFunc func(img *image.Paletted, x, y, size, angle int)
// draw a polygon by points, and the polygon is rotated by angle.
-func drawBlock(img *image.Paletted, x, y, size int, angle int, points []int) {
+func drawBlock(img *image.Paletted, x, y, size, angle int, points []int) {
if angle != 0 {
m := size / 2
rotate(points, m, m, angle)
@@ -41,7 +41,7 @@ func drawBlock(img *image.Paletted, x, y, size int, angle int, points []int) {
// | |
// | |
// --------
-func b0(img *image.Paletted, x, y, size int, angle int) {}
+func b0(img *image.Paletted, x, y, size, angle int) {}
// full-filled
//
@@ -50,7 +50,7 @@ func b0(img *image.Paletted, x, y, size int, angle int) {}
// |######|
// |######|
// --------
-func b1(img *image.Paletted, x, y, size int, angle int) {
+func b1(img *image.Paletted, x, y, size, angle int) {
for i := x; i < x+size; i++ {
for j := y; j < y+size; j++ {
img.SetColorIndex(i, j, 1)
@@ -65,7 +65,7 @@ func b1(img *image.Paletted, x, y, size int, angle int) {
// | #### |
// | |
// ----------
-func b2(img *image.Paletted, x, y, size int, angle int) {
+func b2(img *image.Paletted, x, y, size, angle int) {
l := size / 4
x += l
y += l
@@ -88,7 +88,7 @@ func b2(img *image.Paletted, x, y, size int, angle int) {
// | ### |
// | # |
// ---------
-func b3(img *image.Paletted, x, y, size int, angle int) {
+func b3(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, 0, []int{
m, 0,
@@ -108,7 +108,7 @@ func b3(img *image.Paletted, x, y, size int, angle int) {
// |## |
// |# |
// |------
-func b4(img *image.Paletted, x, y, size int, angle int) {
+func b4(img *image.Paletted, x, y, size, angle int) {
drawBlock(img, x, y, size, angle, []int{
0, 0,
size, 0,
@@ -124,7 +124,7 @@ func b4(img *image.Paletted, x, y, size int, angle int) {
// | ### |
// | ##### |
// |#######|
-func b5(img *image.Paletted, x, y, size int, angle int) {
+func b5(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
m, 0,
@@ -141,7 +141,7 @@ func b5(img *image.Paletted, x, y, size int, angle int) {
// |### |
// |### |
// --------
-func b6(img *image.Paletted, x, y, size int, angle int) {
+func b6(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
0, 0,
@@ -160,7 +160,7 @@ func b6(img *image.Paletted, x, y, size int, angle int) {
// | #####|
// | ####|
// |--------
-func b7(img *image.Paletted, x, y, size int, angle int) {
+func b7(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
0, 0,
@@ -181,7 +181,7 @@ func b7(img *image.Paletted, x, y, size int, angle int) {
// | ### ### |
// |#########|
// -----------
-func b8(img *image.Paletted, x, y, size int, angle int) {
+func b8(img *image.Paletted, x, y, size, angle int) {
m := size / 2
mm := m / 2
@@ -219,7 +219,7 @@ func b8(img *image.Paletted, x, y, size int, angle int) {
// | #### |
// | # |
// ---------
-func b9(img *image.Paletted, x, y, size int, angle int) {
+func b9(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
0, 0,
@@ -241,7 +241,7 @@ func b9(img *image.Paletted, x, y, size int, angle int) {
// |## |
// |# |
// ----------
-func b10(img *image.Paletted, x, y, size int, angle int) {
+func b10(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
m, 0,
@@ -267,7 +267,7 @@ func b10(img *image.Paletted, x, y, size int, angle int) {
// | |
// | |
// ----------
-func b11(img *image.Paletted, x, y, size int, angle int) {
+func b11(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
0, 0,
@@ -287,7 +287,7 @@ func b11(img *image.Paletted, x, y, size int, angle int) {
// | ##### |
// | # |
// -----------
-func b12(img *image.Paletted, x, y, size int, angle int) {
+func b12(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
0, m,
@@ -306,7 +306,7 @@ func b12(img *image.Paletted, x, y, size int, angle int) {
// | ##### |
// |#########|
// -----------
-func b13(img *image.Paletted, x, y, size int, angle int) {
+func b13(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
m, m,
@@ -325,7 +325,7 @@ func b13(img *image.Paletted, x, y, size int, angle int) {
// | |
// | |
// ---------
-func b14(img *image.Paletted, x, y, size int, angle int) {
+func b14(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
m, 0,
@@ -344,7 +344,7 @@ func b14(img *image.Paletted, x, y, size int, angle int) {
// | |
// | |
// ----------
-func b15(img *image.Paletted, x, y, size int, angle int) {
+func b15(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
0, 0,
@@ -364,7 +364,7 @@ func b15(img *image.Paletted, x, y, size int, angle int) {
// | ##### |
// |#######|
// ---------
-func b16(img *image.Paletted, x, y, size int, angle int) {
+func b16(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
m, 0,
@@ -390,7 +390,7 @@ func b16(img *image.Paletted, x, y, size int, angle int) {
// | ##|
// | ##|
// ----------
-func b17(img *image.Paletted, x, y, size int, angle int) {
+func b17(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
@@ -419,7 +419,7 @@ func b17(img *image.Paletted, x, y, size int, angle int) {
// |## |
// |# |
// ----------
-func b18(img *image.Paletted, x, y, size int, angle int) {
+func b18(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
@@ -439,7 +439,7 @@ func b18(img *image.Paletted, x, y, size int, angle int) {
// |### ###|
// |########|
// ----------
-func b19(img *image.Paletted, x, y, size int, angle int) {
+func b19(img *image.Paletted, x, y, size, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
@@ -480,7 +480,7 @@ func b19(img *image.Paletted, x, y, size int, angle int) {
// |## |
// |# |
// ----------
-func b20(img *image.Paletted, x, y, size int, angle int) {
+func b20(img *image.Paletted, x, y, size, angle int) {
m := size / 2
q := size / 4
@@ -501,7 +501,7 @@ func b20(img *image.Paletted, x, y, size int, angle int) {
// |## |
// |# |
// ----------
-func b21(img *image.Paletted, x, y, size int, angle int) {
+func b21(img *image.Paletted, x, y, size, angle int) {
m := size / 2
q := size / 4
@@ -529,7 +529,7 @@ func b21(img *image.Paletted, x, y, size int, angle int) {
// |## ##|
// |# #|
// ----------
-func b22(img *image.Paletted, x, y, size int, angle int) {
+func b22(img *image.Paletted, x, y, size, angle int) {
m := size / 2
q := size / 4
@@ -557,7 +557,7 @@ func b22(img *image.Paletted, x, y, size int, angle int) {
// |## |
// |# |
// ----------
-func b23(img *image.Paletted, x, y, size int, angle int) {
+func b23(img *image.Paletted, x, y, size, angle int) {
m := size / 2
q := size / 4
@@ -585,7 +585,7 @@ func b23(img *image.Paletted, x, y, size int, angle int) {
// |## ## |
// |# # |
// ----------
-func b24(img *image.Paletted, x, y, size int, angle int) {
+func b24(img *image.Paletted, x, y, size, angle int) {
m := size / 2
q := size / 4
@@ -613,7 +613,7 @@ func b24(img *image.Paletted, x, y, size int, angle int) {
// |###### |
// |#### |
// ----------
-func b25(img *image.Paletted, x, y, size int, angle int) {
+func b25(img *image.Paletted, x, y, size, angle int) {
m := size / 2
q := size / 4
@@ -641,7 +641,7 @@ func b25(img *image.Paletted, x, y, size int, angle int) {
// |### ###|
// |# #|
// ----------
-func b26(img *image.Paletted, x, y, size int, angle int) {
+func b26(img *image.Paletted, x, y, size, angle int) {
m := size / 2
q := size / 4
@@ -683,7 +683,7 @@ func b26(img *image.Paletted, x, y, size int, angle int) {
// |### ##|
// |########|
// ----------
-func b27(img *image.Paletted, x, y, size int, angle int) {
+func b27(img *image.Paletted, x, y, size, angle int) {
m := size / 2
q := size / 4
diff --git a/modules/avatar/identicon/polygon.go b/modules/avatar/identicon/polygon.go
index 02890737da..88440633c2 100644
--- a/modules/avatar/identicon/polygon.go
+++ b/modules/avatar/identicon/polygon.go
@@ -16,7 +16,7 @@ var (
// rotate the points by center point (x,y)
// angle: [0,1,2,3] means [0,90,180,270] degree
-func rotate(points []int, x, y int, angle int) {
+func rotate(points []int, x, y, angle int) {
// the angle is only used internally, and it has been guaranteed to be 0/1/2/3, so we do not check it again
for i := 0; i < len(points); i += 2 {
px, py := points[i]-x, points[i+1]-y
diff --git a/modules/base/tool.go b/modules/base/tool.go
index 775fd709cf..dff0d70420 100644
--- a/modules/base/tool.go
+++ b/modules/base/tool.go
@@ -149,7 +149,7 @@ func PrettyNumber(v int64) string {
}
// Subtract deals with subtraction of all types of number.
-func Subtract(left interface{}, right interface{}) interface{} {
+func Subtract(left, right interface{}) interface{} {
var rleft, rright int64
var fleft, fright float64
var isInt = true
diff --git a/modules/charset/charset_test.go b/modules/charset/charset_test.go
index 33f0c10a7a..8957bf3c1c 100644
--- a/modules/charset/charset_test.go
+++ b/modules/charset/charset_test.go
@@ -261,14 +261,14 @@ func TestDetectEncoding(t *testing.T) {
assert.Error(t, err)
}
-func stringMustStartWith(t *testing.T, expected string, value string) {
+func stringMustStartWith(t *testing.T, expected, value string) {
assert.Equal(t, expected, string(value[:len(expected)]))
}
-func stringMustEndWith(t *testing.T, expected string, value string) {
+func stringMustEndWith(t *testing.T, expected, value string) {
assert.Equal(t, expected, string(value[len(value)-len(expected):]))
}
-func bytesMustStartWith(t *testing.T, expected []byte, value []byte) {
+func bytesMustStartWith(t *testing.T, expected, value []byte) {
assert.Equal(t, expected, value[:len(expected)])
}
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
}
diff --git a/modules/eventsource/event.go b/modules/eventsource/event.go
index 8fc3221c18..9fe20715e3 100644
--- a/modules/eventsource/event.go
+++ b/modules/eventsource/event.go
@@ -14,7 +14,7 @@ import (
"code.gitea.io/gitea/modules/json"
)
-func wrapNewlines(w io.Writer, prefix []byte, value []byte) (sum int64, err error) {
+func wrapNewlines(w io.Writer, prefix, value []byte) (sum int64, err error) {
if len(value) == 0 {
return
}
diff --git a/modules/git/repo.go b/modules/git/repo.go
index 3950bb4a92..b19e80cd44 100644
--- a/modules/git/repo.go
+++ b/modules/git/repo.go
@@ -386,7 +386,7 @@ type DivergeObject struct {
Behind int
}
-func checkDivergence(repoPath string, baseBranch string, targetBranch string) (int, error) {
+func checkDivergence(repoPath, baseBranch, targetBranch string) (int, error) {
branches := fmt.Sprintf("%s..%s", baseBranch, targetBranch)
cmd := NewCommand("rev-list", "--count", branches)
stdout, err := cmd.RunInDir(repoPath)
@@ -401,7 +401,7 @@ func checkDivergence(repoPath string, baseBranch string, targetBranch string) (i
}
// GetDivergingCommits returns the number of commits a targetBranch is ahead or behind a baseBranch
-func GetDivergingCommits(repoPath string, baseBranch string, targetBranch string) (DivergeObject, error) {
+func GetDivergingCommits(repoPath, baseBranch, targetBranch string) (DivergeObject, error) {
// $(git rev-list --count master..feature) commits ahead of master
ahead, errorAhead := checkDivergence(repoPath, baseBranch, targetBranch)
if errorAhead != nil {
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go
index 3afabac27b..896ad34518 100644
--- a/modules/git/repo_commit.go
+++ b/modules/git/repo_commit.go
@@ -264,7 +264,7 @@ func (repo *Repository) FilesCountBetween(startCommitID, endCommitID string) (in
// CommitsBetween returns a list that contains commits between [before, last).
// If before is detached (removed by reset + push) it is not included.
-func (repo *Repository) CommitsBetween(last *Commit, before *Commit) ([]*Commit, error) {
+func (repo *Repository) CommitsBetween(last, before *Commit) ([]*Commit, error) {
var stdout []byte
var err error
if before == nil {
@@ -284,7 +284,7 @@ func (repo *Repository) CommitsBetween(last *Commit, before *Commit) ([]*Commit,
}
// CommitsBetweenLimit returns a list that contains at most limit commits skipping the first skip commits between [before, last)
-func (repo *Repository) CommitsBetweenLimit(last *Commit, before *Commit, limit, skip int) ([]*Commit, error) {
+func (repo *Repository) CommitsBetweenLimit(last, before *Commit, limit, skip int) ([]*Commit, error) {
var stdout []byte
var err error
if before == nil {
diff --git a/modules/git/repo_compare.go b/modules/git/repo_compare.go
index 5fe37aed7b..992a70733b 100644
--- a/modules/git/repo_compare.go
+++ b/modules/git/repo_compare.go
@@ -27,7 +27,7 @@ type CompareInfo struct {
}
// GetMergeBase checks and returns merge base of two branches and the reference used as base.
-func (repo *Repository) GetMergeBase(tmpRemote string, base, head string) (string, string, error) {
+func (repo *Repository) GetMergeBase(tmpRemote, base, head string) (string, string, error) {
if tmpRemote == "" {
tmpRemote = "origin"
}
diff --git a/modules/git/repo_tree.go b/modules/git/repo_tree.go
index f57c26ffee..79d31b62b5 100644
--- a/modules/git/repo_tree.go
+++ b/modules/git/repo_tree.go
@@ -23,7 +23,7 @@ type CommitTreeOpts struct {
}
// CommitTree creates a commit from a given tree id for the user with provided message
-func (repo *Repository) CommitTree(author *Signature, committer *Signature, tree *Tree, opts CommitTreeOpts) (SHA1, error) {
+func (repo *Repository) CommitTree(author, committer *Signature, tree *Tree, opts CommitTreeOpts) (SHA1, error) {
err := LoadGitVersion()
if err != nil {
return SHA1{}, err
diff --git a/modules/git/utils.go b/modules/git/utils.go
index 6988f31a36..53c124ac8a 100644
--- a/modules/git/utils.go
+++ b/modules/git/utils.go
@@ -125,7 +125,7 @@ func SplitRefName(refStr string) (string, string) {
// 0 is false, true
// Any other integer is true, true
// Anything else will return false, false
-func ParseBool(value string) (result bool, valid bool) {
+func ParseBool(value string) (result, valid bool) {
// Empty strings are true but invalid
if len(value) == 0 {
return true, false
diff --git a/modules/gitgraph/graph.go b/modules/gitgraph/graph.go
index cf994bfd4c..8f04941147 100644
--- a/modules/gitgraph/graph.go
+++ b/modules/gitgraph/graph.go
@@ -17,7 +17,7 @@ import (
)
// GetCommitGraph return a list of commit (GraphItems) from all branches
-func GetCommitGraph(r *git.Repository, page int, maxAllowedColors int, hidePRRefs bool, branches, files []string) (*Graph, error) {
+func GetCommitGraph(r *git.Repository, page, maxAllowedColors int, hidePRRefs bool, branches, files []string) (*Graph, error) {
format := "DATA:%D|%H|%ad|%h|%s"
if page == 0 {
diff --git a/modules/hostmatcher/hostmatcher.go b/modules/hostmatcher/hostmatcher.go
index 815b8c4e4a..9492a479f1 100644
--- a/modules/hostmatcher/hostmatcher.go
+++ b/modules/hostmatcher/hostmatcher.go
@@ -39,7 +39,7 @@ func isBuiltin(s string) bool {
}
// ParseHostMatchList parses the host list HostMatchList
-func ParseHostMatchList(settingKeyHint string, hostList string) *HostMatchList {
+func ParseHostMatchList(settingKeyHint, hostList string) *HostMatchList {
hl := &HostMatchList{SettingKeyHint: settingKeyHint, SettingValue: hostList}
for _, s := range strings.Split(hostList, ",") {
s = strings.ToLower(strings.TrimSpace(s))
@@ -59,7 +59,7 @@ func ParseHostMatchList(settingKeyHint string, hostList string) *HostMatchList {
}
// ParseSimpleMatchList parse a simple matchlist (no built-in networks, no CIDR support, only wildcard pattern match)
-func ParseSimpleMatchList(settingKeyHint string, matchList string) *HostMatchList {
+func ParseSimpleMatchList(settingKeyHint, matchList string) *HostMatchList {
hl := &HostMatchList{
SettingKeyHint: settingKeyHint,
SettingValue: matchList,
diff --git a/modules/hostmatcher/http.go b/modules/hostmatcher/http.go
index 9dae61a44c..31430a9595 100644
--- a/modules/hostmatcher/http.go
+++ b/modules/hostmatcher/http.go
@@ -13,7 +13,7 @@ import (
)
// NewDialContext returns a DialContext for Transport, the DialContext will do allow/block list check
-func NewDialContext(usage string, allowList *HostMatchList, blockList *HostMatchList) func(ctx context.Context, network, addr string) (net.Conn, error) {
+func NewDialContext(usage string, allowList, blockList *HostMatchList) func(ctx context.Context, network, addr string) (net.Conn, error) {
// How Go HTTP Client works with redirection:
// transport.RoundTrip URL=http://domain.com, Host=domain.com
// transport.DialContext addrOrHost=domain.com:80
diff --git a/modules/log/multichannel.go b/modules/log/multichannel.go
index d28071c3f7..c725df4f3e 100644
--- a/modules/log/multichannel.go
+++ b/modules/log/multichannel.go
@@ -80,7 +80,7 @@ func (l *MultiChannelledLogger) Log(skip int, level Level, format string, v ...i
}
// SendLog sends a log event at the provided level with the information given
-func (l *MultiChannelledLogger) SendLog(level Level, caller, filename string, line int, msg string, stack string) error {
+func (l *MultiChannelledLogger) SendLog(level Level, caller, filename string, line int, msg, stack string) error {
if l.GetLevel() > level {
return nil
}
diff --git a/modules/log/writer.go b/modules/log/writer.go
index 6f656c7ce1..e8d06b67ab 100644
--- a/modules/log/writer.go
+++ b/modules/log/writer.go
@@ -73,7 +73,7 @@ func (logger *WriterLogger) GetStacktraceLevel() Level {
}
// Copy of cheap integer to fixed-width decimal to ascii from logger.
-func itoa(buf *[]byte, i int, wid int) {
+func itoa(buf *[]byte, i, wid int) {
var logger [20]byte
bp := len(logger) - 1
for i >= 10 || wid > 1 {
diff --git a/modules/markup/markdown/goldmark.go b/modules/markup/markdown/goldmark.go
index 43023220a5..83afb8b663 100644
--- a/modules/markup/markdown/goldmark.go
+++ b/modules/markup/markdown/goldmark.go
@@ -229,7 +229,7 @@ func (p *prefixedIDs) Generate(value []byte, kind ast.NodeKind) []byte {
}
// Generate generates a new element id.
-func (p *prefixedIDs) GenerateWithDefault(value []byte, dft []byte) []byte {
+func (p *prefixedIDs) GenerateWithDefault(value, dft []byte) []byte {
result := common.CleanValue(value)
if len(result) == 0 {
result = dft
diff --git a/modules/notification/action/action.go b/modules/notification/action/action.go
index 88395d929a..95b0d6cbef 100644
--- a/modules/notification/action/action.go
+++ b/modules/notification/action/action.go
@@ -179,7 +179,7 @@ func (a *actionNotifier) NotifyTransferRepository(doer *user_model.User, repo *r
}
}
-func (a *actionNotifier) NotifyCreateRepository(doer *user_model.User, u *user_model.User, repo *repo_model.Repository) {
+func (a *actionNotifier) NotifyCreateRepository(doer, u *user_model.User, repo *repo_model.Repository) {
if err := models.NotifyWatchers(&models.Action{
ActUserID: doer.ID,
ActUser: doer,
diff --git a/modules/notification/base/null.go b/modules/notification/base/null.go
index 062edf400d..e284c72b12 100644
--- a/modules/notification/base/null.go
+++ b/modules/notification/base/null.go
@@ -122,7 +122,7 @@ func (*NullNotifier) NotifyIssueChangeLabels(doer *user_model.User, issue *model
}
// NotifyCreateRepository places a place holder function
-func (*NullNotifier) NotifyCreateRepository(doer *user_model.User, u *user_model.User, repo *repo_model.Repository) {
+func (*NullNotifier) NotifyCreateRepository(doer, u *user_model.User, repo *repo_model.Repository) {
}
// NotifyDeleteRepository places a place holder function
@@ -134,7 +134,7 @@ func (*NullNotifier) NotifyForkRepository(doer *user_model.User, oldRepo, repo *
}
// NotifyMigrateRepository places a place holder function
-func (*NullNotifier) NotifyMigrateRepository(doer *user_model.User, u *user_model.User, repo *repo_model.Repository) {
+func (*NullNotifier) NotifyMigrateRepository(doer, u *user_model.User, repo *repo_model.Repository) {
}
// NotifyPushCommits notifies commits pushed to notifiers
diff --git a/modules/notification/indexer/indexer.go b/modules/notification/indexer/indexer.go
index 92fe3c5019..715ec724c3 100644
--- a/modules/notification/indexer/indexer.go
+++ b/modules/notification/indexer/indexer.go
@@ -115,7 +115,7 @@ func (r *indexerNotifier) NotifyDeleteRepository(doer *user_model.User, repo *re
}
}
-func (r *indexerNotifier) NotifyMigrateRepository(doer *user_model.User, u *user_model.User, repo *repo_model.Repository) {
+func (r *indexerNotifier) NotifyMigrateRepository(doer, u *user_model.User, repo *repo_model.Repository) {
issue_indexer.UpdateRepoIndexer(repo)
if setting.Indexer.RepoIndexerEnabled && !repo.IsEmpty {
code_indexer.UpdateRepoIndexer(repo)
diff --git a/modules/notification/notification.go b/modules/notification/notification.go
index d976dfea66..be8eb1c252 100644
--- a/modules/notification/notification.go
+++ b/modules/notification/notification.go
@@ -210,14 +210,14 @@ func NotifyIssueChangeLabels(doer *user_model.User, issue *models.Issue,
}
// NotifyCreateRepository notifies create repository to notifiers
-func NotifyCreateRepository(doer *user_model.User, u *user_model.User, repo *repo_model.Repository) {
+func NotifyCreateRepository(doer, u *user_model.User, repo *repo_model.Repository) {
for _, notifier := range notifiers {
notifier.NotifyCreateRepository(doer, u, repo)
}
}
// NotifyMigrateRepository notifies create repository to notifiers
-func NotifyMigrateRepository(doer *user_model.User, u *user_model.User, repo *repo_model.Repository) {
+func NotifyMigrateRepository(doer, u *user_model.User, repo *repo_model.Repository) {
for _, notifier := range notifiers {
notifier.NotifyMigrateRepository(doer, u, repo)
}
diff --git a/modules/notification/webhook/webhook.go b/modules/notification/webhook/webhook.go
index 7e96ed0501..16ec31318b 100644
--- a/modules/notification/webhook/webhook.go
+++ b/modules/notification/webhook/webhook.go
@@ -102,7 +102,7 @@ func (m *webhookNotifier) NotifyForkRepository(doer *user_model.User, oldRepo, r
}
}
-func (m *webhookNotifier) NotifyCreateRepository(doer *user_model.User, u *user_model.User, repo *repo_model.Repository) {
+func (m *webhookNotifier) NotifyCreateRepository(doer, u *user_model.User, repo *repo_model.Repository) {
// Add to hook queue for created repo after session commit.
if err := webhook_services.PrepareWebhooks(repo, webhook.HookEventRepository, &api.RepositoryPayload{
Action: api.HookRepoCreated,
@@ -127,7 +127,7 @@ func (m *webhookNotifier) NotifyDeleteRepository(doer *user_model.User, repo *re
}
}
-func (m *webhookNotifier) NotifyMigrateRepository(doer *user_model.User, u *user_model.User, repo *repo_model.Repository) {
+func (m *webhookNotifier) NotifyMigrateRepository(doer, u *user_model.User, repo *repo_model.Repository) {
// Add to hook queue for created repo after session commit.
if err := webhook_services.PrepareWebhooks(repo, webhook.HookEventRepository, &api.RepositoryPayload{
Action: api.HookRepoCreated,
diff --git a/modules/references/references.go b/modules/references/references.go
index ef859abcc7..cfc01cd4c0 100644
--- a/modules/references/references.go
+++ b/modules/references/references.go
@@ -151,7 +151,7 @@ func newKeywords() {
})
}
-func doNewKeywords(close []string, reopen []string) {
+func doNewKeywords(close, reopen []string) {
issueCloseKeywordsPat = makeKeywordsPat(close)
issueReopenKeywordsPat = makeKeywordsPat(reopen)
}
@@ -467,7 +467,7 @@ func findAllIssueReferencesBytes(content []byte, links []string) []*rawReference
return ret
}
-func getCrossReference(content []byte, start, end int, fromLink bool, prOnly bool) *rawReference {
+func getCrossReference(content []byte, start, end int, fromLink, prOnly bool) *rawReference {
sep := bytes.IndexAny(content[start:end], "#!")
if sep < 0 {
return nil
@@ -537,7 +537,7 @@ func findActionKeywords(content []byte, start int) (XRefAction, *RefSpan) {
}
// IsXrefActionable returns true if the xref action is actionable (i.e. produces a result when resolved)
-func IsXrefActionable(ref *RenderizableReference, extTracker bool, alphaNum bool) bool {
+func IsXrefActionable(ref *RenderizableReference, extTracker, alphaNum bool) bool {
if extTracker {
// External issues cannot be automatically closed
return false
diff --git a/modules/secret/secret.go b/modules/secret/secret.go
index 976924ac60..6a5024b729 100644
--- a/modules/secret/secret.go
+++ b/modules/secret/secret.go
@@ -65,7 +65,7 @@ func AesDecrypt(key, text []byte) ([]byte, error) {
}
// EncryptSecret encrypts a string with given key into a hex string
-func EncryptSecret(key string, str string) (string, error) {
+func EncryptSecret(key, str string) (string, error) {
keyHash := sha256.Sum256([]byte(key))
plaintext := []byte(str)
ciphertext, err := AesEncrypt(keyHash[:], plaintext)
@@ -76,7 +76,7 @@ func EncryptSecret(key string, str string) (string, error) {
}
// DecryptSecret decrypts a previously encrypted hex string
-func DecryptSecret(key string, cipherhex string) (string, error) {
+func DecryptSecret(key, cipherhex string) (string, error) {
keyHash := sha256.Sum256([]byte(key))
ciphertext, err := hex.DecodeString(cipherhex)
if err != nil {
diff --git a/modules/setting/log.go b/modules/setting/log.go
index 4114ea99cb..b0ae5fb646 100644
--- a/modules/setting/log.go
+++ b/modules/setting/log.go
@@ -67,7 +67,7 @@ func AddSubLogDescription(key string, subLogDescription SubLogDescription) bool
}
// RemoveSubLogDescription removes a sub log description
-func RemoveSubLogDescription(key string, name string) bool {
+func RemoveSubLogDescription(key, name string) bool {
descriptionLock.Lock()
defer descriptionLock.Unlock()
desc, ok := logDescriptions[key]
@@ -119,7 +119,7 @@ func getLogLevel(section *ini.Section, key string, defaultValue log.Level) log.L
return log.FromString(value)
}
-func getStacktraceLogLevel(section *ini.Section, key string, defaultValue string) string {
+func getStacktraceLogLevel(section *ini.Section, key, defaultValue string) string {
value := section.Key(key).MustString(defaultValue)
return log.FromString(value).String()
}
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 83904080de..2ba6bcf9e7 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -1115,7 +1115,7 @@ func generateSaveInternalToken() {
}
// MakeAbsoluteAssetURL returns the absolute asset url prefix without a trailing slash
-func MakeAbsoluteAssetURL(appURL string, staticURLPrefix string) string {
+func MakeAbsoluteAssetURL(appURL, staticURLPrefix string) string {
parsedPrefix, err := url.Parse(strings.TrimSuffix(staticURLPrefix, "/"))
if err != nil {
log.Fatal("Unable to parse STATIC_URL_PREFIX: %v", err)
@@ -1134,7 +1134,7 @@ func MakeAbsoluteAssetURL(appURL string, staticURLPrefix string) string {
}
// MakeManifestData generates web app manifest JSON
-func MakeManifestData(appName string, appURL string, absoluteAssetURL string) []byte {
+func MakeManifestData(appName, appURL, absoluteAssetURL string) []byte {
type manifestIcon struct {
Src string `json:"src"`
Type string `json:"type"`
diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go
index a3756fd2af..4f876ec39a 100644
--- a/modules/ssh/ssh.go
+++ b/modules/ssh/ssh.go
@@ -263,7 +263,7 @@ func sshConnectionFailed(conn net.Conn, err error) {
}
// Listen starts a SSH server listens on given port.
-func Listen(host string, port int, ciphers []string, keyExchanges []string, macs []string) {
+func Listen(host string, port int, ciphers, keyExchanges, macs []string) {
srv := ssh.Server{
Addr: net.JoinHostPort(host, strconv.Itoa(port)),
PublicKeyHandler: publicKeyHandler,
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index c1c6b40347..a05c0c1a95 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -524,7 +524,7 @@ func parseOthers(defaultSize int, defaultClass string, others ...interface{}) (i
}
// AvatarHTML creates the HTML for an avatar
-func AvatarHTML(src string, size int, class string, name string) template.HTML {
+func AvatarHTML(src string, size int, class, name string) template.HTML {
sizeStr := fmt.Sprintf(`%d`, size)
if name == "" {
@@ -594,7 +594,7 @@ func RepoAvatar(repo *repo_model.Repository, others ...interface{}) template.HTM
}
// AvatarByEmail renders avatars by email address. args: email, name, size (int), class (string)
-func AvatarByEmail(email string, name string, others ...interface{}) template.HTML {
+func AvatarByEmail(email, name string, others ...interface{}) template.HTML {
size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar image", others...)
src := avatars.GenerateEmailAvatarFastLink(email, size*setting.Avatar.RenderedSizeFactor)
diff --git a/modules/upload/upload.go b/modules/upload/upload.go
index 9d20f1082f..734b3a6acc 100644
--- a/modules/upload/upload.go
+++ b/modules/upload/upload.go
@@ -35,7 +35,7 @@ func (err ErrFileTypeForbidden) Error() string {
var wildcardTypeRe = regexp.MustCompile(`^[a-z]+/\*$`)
// Verify validates whether a file is allowed to be uploaded.
-func Verify(buf []byte, fileName string, allowedTypesStr string) error {
+func Verify(buf []byte, fileName, allowedTypesStr string) error {
allowedTypesStr = strings.ReplaceAll(allowedTypesStr, "|", ",") // compat for old config format
allowedTypes := []string{}
diff --git a/modules/util/compare.go b/modules/util/compare.go
index cd9ba0d91c..49891ef024 100644
--- a/modules/util/compare.go
+++ b/modules/util/compare.go
@@ -71,7 +71,7 @@ func IsInt64InSlice(target int64, slice []int64) bool {
}
// IsEqualSlice returns true if slices are equal.
-func IsEqualSlice(target []string, source []string) bool {
+func IsEqualSlice(target, source []string) bool {
if len(target) != len(source) {
return false
}
diff --git a/modules/util/path.go b/modules/util/path.go
index e79747327d..cad50eddc2 100644
--- a/modules/util/path.go
+++ b/modules/util/path.go
@@ -17,7 +17,7 @@ import (
// EnsureAbsolutePath ensure that a path is absolute, making it
// relative to absoluteBase if necessary
-func EnsureAbsolutePath(path string, absoluteBase string) string {
+func EnsureAbsolutePath(path, absoluteBase string) string {
if filepath.IsAbs(path) {
return path
}
diff --git a/modules/web/middleware/cookie.go b/modules/web/middleware/cookie.go
index f44d2c3688..80fe302137 100644
--- a/modules/web/middleware/cookie.go
+++ b/modules/web/middleware/cookie.go
@@ -119,7 +119,7 @@ func DeleteCSRFCookie(resp http.ResponseWriter) {
// SetCookie set the cookies
// TODO: Copied from gitea.com/macaron/macaron and should be improved after macaron removed.
-func SetCookie(resp http.ResponseWriter, name string, value string, others ...interface{}) {
+func SetCookie(resp http.ResponseWriter, name, value string, others ...interface{}) {
cookie := http.Cookie{}
cookie.Name = name
cookie.Value = url.QueryEscape(value)
diff --git a/modules/web/route.go b/modules/web/route.go
index ad9cea8bb6..1d9c92bd7a 100644
--- a/modules/web/route.go
+++ b/modules/web/route.go
@@ -251,7 +251,7 @@ func (r *Route) Any(pattern string, h ...interface{}) {
}
// Route delegate special methods
-func (r *Route) Route(pattern string, methods string, h ...interface{}) {
+func (r *Route) Route(pattern, methods string, h ...interface{}) {
p := r.getPattern(pattern)
ms := strings.Split(methods, ",")
var middlewares = r.getMiddlewares(h)