diff options
author | silverwind <me@silverwind.io> | 2024-06-11 20:47:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-11 18:47:45 +0000 |
commit | fc2d75f86d77b022ece848acf2581c14ef21d43b (patch) | |
tree | c95effed84f093643d8408b7cd32123a1114962d /services | |
parent | 4bf848a06bfa069e5f381235193924f2b35f2d9d (diff) | |
download | gitea-fc2d75f86d77b022ece848acf2581c14ef21d43b.tar.gz gitea-fc2d75f86d77b022ece848acf2581c14ef21d43b.zip |
Enable `unparam` linter (#31277)
Enable [unparam](https://github.com/mvdan/unparam) linter.
Often I could not tell the intention why param is unused, so I put
`//nolint` for those cases like webhook request creation functions never
using `ctx`.
---------
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'services')
-rw-r--r-- | services/pull/merge.go | 2 | ||||
-rw-r--r-- | services/webhook/dingtalk.go | 2 | ||||
-rw-r--r-- | services/webhook/discord.go | 2 | ||||
-rw-r--r-- | services/webhook/feishu.go | 2 | ||||
-rw-r--r-- | services/webhook/matrix.go | 2 | ||||
-rw-r--r-- | services/webhook/msteams.go | 2 | ||||
-rw-r--r-- | services/webhook/packagist.go | 2 | ||||
-rw-r--r-- | services/webhook/slack.go | 2 | ||||
-rw-r--r-- | services/webhook/telegram.go | 2 | ||||
-rw-r--r-- | services/webhook/wechatwork.go | 2 |
10 files changed, 10 insertions, 10 deletions
diff --git a/services/pull/merge.go b/services/pull/merge.go index 6b5e9ea330..9ef3fb2e05 100644 --- a/services/pull/merge.go +++ b/services/pull/merge.go @@ -246,7 +246,7 @@ func Merge(ctx context.Context, pr *issues_model.PullRequest, doer *user_model.U } // doMergeAndPush performs the merge operation without changing any pull information in database and pushes it up to the base repository -func doMergeAndPush(ctx context.Context, pr *issues_model.PullRequest, doer *user_model.User, mergeStyle repo_model.MergeStyle, expectedHeadCommitID, message string, pushTrigger repo_module.PushTrigger) (string, error) { +func doMergeAndPush(ctx context.Context, pr *issues_model.PullRequest, doer *user_model.User, mergeStyle repo_model.MergeStyle, expectedHeadCommitID, message string, pushTrigger repo_module.PushTrigger) (string, error) { //nolint:unparam // Clone base repo. mergeCtx, cancel, err := createTemporaryRepoForMerge(ctx, pr, doer, expectedHeadCommitID) if err != nil { diff --git a/services/webhook/dingtalk.go b/services/webhook/dingtalk.go index c57d04415a..f6018f7374 100644 --- a/services/webhook/dingtalk.go +++ b/services/webhook/dingtalk.go @@ -190,6 +190,6 @@ type dingtalkConvertor struct{} var _ payloadConvertor[DingtalkPayload] = dingtalkConvertor{} -func newDingtalkRequest(ctx context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { +func newDingtalkRequest(_ context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { return newJSONRequest(dingtalkConvertor{}, w, t, true) } diff --git a/services/webhook/discord.go b/services/webhook/discord.go index 3883ac9eb8..31332396f2 100644 --- a/services/webhook/discord.go +++ b/services/webhook/discord.go @@ -260,7 +260,7 @@ type discordConvertor struct { var _ payloadConvertor[DiscordPayload] = discordConvertor{} -func newDiscordRequest(ctx context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { +func newDiscordRequest(_ context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { meta := &DiscordMeta{} if err := json.Unmarshal([]byte(w.Meta), meta); err != nil { return nil, nil, fmt.Errorf("newDiscordRequest meta json: %w", err) diff --git a/services/webhook/feishu.go b/services/webhook/feishu.go index 1ec436894b..38f324aa7b 100644 --- a/services/webhook/feishu.go +++ b/services/webhook/feishu.go @@ -168,6 +168,6 @@ type feishuConvertor struct{} var _ payloadConvertor[FeishuPayload] = feishuConvertor{} -func newFeishuRequest(ctx context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { +func newFeishuRequest(_ context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { return newJSONRequest(feishuConvertor{}, w, t, true) } diff --git a/services/webhook/matrix.go b/services/webhook/matrix.go index 5dcfdcb0dd..e649a07609 100644 --- a/services/webhook/matrix.go +++ b/services/webhook/matrix.go @@ -24,7 +24,7 @@ import ( webhook_module "code.gitea.io/gitea/modules/webhook" ) -func newMatrixRequest(ctx context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { +func newMatrixRequest(_ context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { meta := &MatrixMeta{} if err := json.Unmarshal([]byte(w.Meta), meta); err != nil { return nil, nil, fmt.Errorf("GetMatrixPayload meta json: %w", err) diff --git a/services/webhook/msteams.go b/services/webhook/msteams.go index 99d0106184..b052b9da10 100644 --- a/services/webhook/msteams.go +++ b/services/webhook/msteams.go @@ -347,6 +347,6 @@ type msteamsConvertor struct{} var _ payloadConvertor[MSTeamsPayload] = msteamsConvertor{} -func newMSTeamsRequest(ctx context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { +func newMSTeamsRequest(_ context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { return newJSONRequest(msteamsConvertor{}, w, t, true) } diff --git a/services/webhook/packagist.go b/services/webhook/packagist.go index 7880d8b606..593b97a174 100644 --- a/services/webhook/packagist.go +++ b/services/webhook/packagist.go @@ -112,7 +112,7 @@ type packagistConvertor struct { var _ payloadConvertor[PackagistPayload] = packagistConvertor{} -func newPackagistRequest(ctx context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { +func newPackagistRequest(_ context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { meta := &PackagistMeta{} if err := json.Unmarshal([]byte(w.Meta), meta); err != nil { return nil, nil, fmt.Errorf("newpackagistRequest meta json: %w", err) diff --git a/services/webhook/slack.go b/services/webhook/slack.go index ba8bac27d9..ffa2936bea 100644 --- a/services/webhook/slack.go +++ b/services/webhook/slack.go @@ -283,7 +283,7 @@ type slackConvertor struct { var _ payloadConvertor[SlackPayload] = slackConvertor{} -func newSlackRequest(ctx context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { +func newSlackRequest(_ context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { meta := &SlackMeta{} if err := json.Unmarshal([]byte(w.Meta), meta); err != nil { return nil, nil, fmt.Errorf("newSlackRequest meta json: %w", err) diff --git a/services/webhook/telegram.go b/services/webhook/telegram.go index c2b4820032..de6c878dad 100644 --- a/services/webhook/telegram.go +++ b/services/webhook/telegram.go @@ -191,6 +191,6 @@ type telegramConvertor struct{} var _ payloadConvertor[TelegramPayload] = telegramConvertor{} -func newTelegramRequest(ctx context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { +func newTelegramRequest(_ context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { return newJSONRequest(telegramConvertor{}, w, t, true) } diff --git a/services/webhook/wechatwork.go b/services/webhook/wechatwork.go index 46e7856ecf..2e9d31cb7c 100644 --- a/services/webhook/wechatwork.go +++ b/services/webhook/wechatwork.go @@ -177,6 +177,6 @@ type wechatworkConvertor struct{} var _ payloadConvertor[WechatworkPayload] = wechatworkConvertor{} -func newWechatworkRequest(ctx context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { +func newWechatworkRequest(_ context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) { return newJSONRequest(wechatworkConvertor{}, w, t, true) } |