1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-26 10:36:23 -07:00

refactor: unused parameter should be replaced by underscore

Unused parameters in functions or methods should be replaced with `_`
(underscore) or removed.
This commit is contained in:
deepsource-autofix[bot] 2025-02-19 03:57:55 +00:00 committed by GitHub
parent 74f9e415b4
commit c842ca53f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 20 deletions

View file

@ -78,7 +78,7 @@ func main() {
gcutil.LogFatal().Err(err).Msg("Failed to initialize the database")
}
events.TriggerEvent("db-initialized")
events.RegisterEvent([]string{"db-views-reset"}, func(trigger string, i ...any) error {
events.RegisterEvent([]string{"db-views-reset"}, func(_ string, _ ...any) error {
gcutil.LogInfo().Msg("SQL views reset")
return nil
})

View file

@ -7,7 +7,7 @@ import (
)
func TestPanicRecover(t *testing.T) {
RegisterEvent([]string{"TestPanicRecoverEvt"}, func(tr string, i ...any) error {
RegisterEvent([]string{"TestPanicRecoverEvt"}, func(_ string, i ...any) error {
t.Log("Testing panic recover")
t.Log(i[0])
return nil
@ -21,7 +21,7 @@ func TestPanicRecover(t *testing.T) {
}
func TestEventEditValue(t *testing.T) {
RegisterEvent([]string{"TestEventEditValue"}, func(tr string, i ...any) error {
RegisterEvent([]string{"TestEventEditValue"}, func(_ string, i ...any) error {
p := i[0].(*int)
*p += 1
return nil
@ -35,7 +35,7 @@ func TestEventEditValue(t *testing.T) {
func TestMultipleEventTriggers(t *testing.T) {
triggered := map[string]bool{}
RegisterEvent([]string{"a", "b"}, func(tr string, i ...any) error {
RegisterEvent([]string{"a", "b"}, func(tr string, _ ...any) error {
triggered[tr] = true
return nil
})

View file

@ -118,87 +118,87 @@ func init() {
filterFieldHandlers = map[string]FilterConditionHandler{
"name": &conditionHandler{
fieldType: StringField,
matchFunc: func(r *http.Request, p *Post, _ *Upload, fc *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, p *Post, _ *Upload, fc *FilterCondition) (bool, error) {
return matchString(fc, p.Name)
},
},
"trip": &conditionHandler{
fieldType: StringField,
matchFunc: func(r *http.Request, p *Post, _ *Upload, fc *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, p *Post, _ *Upload, fc *FilterCondition) (bool, error) {
return matchString(fc, p.Tripcode)
},
},
"email": &conditionHandler{
fieldType: StringField,
matchFunc: func(r *http.Request, p *Post, _ *Upload, fc *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, p *Post, _ *Upload, fc *FilterCondition) (bool, error) {
return matchString(fc, p.Email)
},
},
"subject": &conditionHandler{
fieldType: StringField,
matchFunc: func(r *http.Request, p *Post, _ *Upload, fc *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, p *Post, _ *Upload, fc *FilterCondition) (bool, error) {
return matchString(fc, p.Subject)
},
},
"body": &conditionHandler{
fieldType: StringField,
matchFunc: func(r *http.Request, p *Post, _ *Upload, fc *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, p *Post, _ *Upload, fc *FilterCondition) (bool, error) {
return matchString(fc, p.MessageRaw)
},
},
"firsttimeboard": &conditionHandler{
fieldType: BooleanField,
matchFunc: func(r *http.Request, p *Post, _ *Upload, _ *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, p *Post, _ *Upload, _ *FilterCondition) (bool, error) {
return firstPost(p, false)
},
},
"notfirsttimeboard": &conditionHandler{
fieldType: BooleanField,
matchFunc: func(r *http.Request, p *Post, _ *Upload, _ *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, p *Post, _ *Upload, _ *FilterCondition) (bool, error) {
first, err := firstPost(p, false)
return !first, err
},
},
"firsttimesite": &conditionHandler{
fieldType: BooleanField,
matchFunc: func(r *http.Request, p *Post, _ *Upload, _ *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, p *Post, _ *Upload, _ *FilterCondition) (bool, error) {
return firstPost(p, true)
},
},
"notfirsttimesite": &conditionHandler{
fieldType: BooleanField,
matchFunc: func(r *http.Request, p *Post, _ *Upload, _ *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, p *Post, _ *Upload, _ *FilterCondition) (bool, error) {
first, err := firstPost(p, true)
return !first, err
},
},
"isop": &conditionHandler{
fieldType: BooleanField,
matchFunc: func(r *http.Request, p *Post, _ *Upload, _ *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, p *Post, _ *Upload, _ *FilterCondition) (bool, error) {
return p.IsTopPost, nil
},
},
"notop": &conditionHandler{
fieldType: BooleanField,
matchFunc: func(r *http.Request, p *Post, _ *Upload, _ *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, p *Post, _ *Upload, _ *FilterCondition) (bool, error) {
return !p.IsTopPost, nil
},
},
"hasfile": &conditionHandler{
fieldType: BooleanField,
matchFunc: func(r *http.Request, p *Post, u *Upload, fc *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, _ *Post, u *Upload, _ *FilterCondition) (bool, error) {
return u != nil, nil
},
},
"nofile": &conditionHandler{
fieldType: BooleanField,
matchFunc: func(r *http.Request, p *Post, u *Upload, fc *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, _ *Post, u *Upload, _ *FilterCondition) (bool, error) {
return u == nil, nil
},
},
"filename": &conditionHandler{
fieldType: StringField,
matchFunc: func(r *http.Request, p *Post, u *Upload, fc *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, _ *Post, u *Upload, fc *FilterCondition) (bool, error) {
if u == nil {
return false, nil
}
@ -207,7 +207,7 @@ func init() {
},
"checksum": &conditionHandler{
fieldType: StringField,
matchFunc: func(r *http.Request, p *Post, u *Upload, fc *FilterCondition) (bool, error) {
matchFunc: func(_ *http.Request, _ *Post, u *Upload, fc *FilterCondition) (bool, error) {
if u == nil {
return false, nil
}
@ -216,7 +216,7 @@ func init() {
},
"useragent": &conditionHandler{
fieldType: StringField,
matchFunc: func(r *http.Request, p *Post, _ *Upload, fc *FilterCondition) (bool, error) {
matchFunc: func(r *http.Request, _ *Post, _ *Upload, fc *FilterCondition) (bool, error) {
return matchString(fc, r.UserAgent())
},
},