mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
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>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
@@ -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)
|
||||
|
@@ -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)
|
||||
}
|
||||
|
@@ -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)
|
||||
|
@@ -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)
|
||||
}
|
||||
|
@@ -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)
|
||||
|
@@ -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)
|
||||
|
@@ -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)
|
||||
}
|
||||
|
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user