mirror of
https://github.com/MontFerret/ferret.git
synced 2025-07-05 00:49:00 +02:00
Linter Cleanups (#294)
* sync with MontFerret/ferret * fix --param handling When params is converted to map it uses strings.Split, which slices a string into all substrings separated by :. * remove impossible conditions nil != nil * delete ineffectual assignments * replace '+= 1' with '++' * remove useless comparison with nil * merge variable declarations * remove bool comparison * fix imports * fix imports * delete unused file * use copy instead of loop * delete unused DummyInterface * remove unnecassary break statements * tidy modules
This commit is contained in:
@ -155,11 +155,9 @@ func newDocLoadParams(url values.String, arg core.Value) (DocumentLoadParams, er
|
||||
res.Header = header
|
||||
}
|
||||
|
||||
break
|
||||
case types.String:
|
||||
res.Driver = arg.(values.String).String()
|
||||
|
||||
break
|
||||
case types.Boolean:
|
||||
b := arg.(values.Boolean)
|
||||
|
||||
@ -168,7 +166,6 @@ func newDocLoadParams(url values.String, arg core.Value) (DocumentLoadParams, er
|
||||
res.Driver = cdp.DriverName
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
return res, nil
|
||||
@ -196,9 +193,7 @@ func parseCookies(arr *values.Array) ([]drivers.HTTPCookie, error) {
|
||||
}
|
||||
|
||||
func parseCookie(value core.Value) (drivers.HTTPCookie, error) {
|
||||
var err error
|
||||
|
||||
err = core.ValidateType(value, types.Object, drivers.HTTPCookieType)
|
||||
err := core.ValidateType(value, types.Object, drivers.HTTPCookieType)
|
||||
|
||||
if err != nil {
|
||||
return drivers.HTTPCookie{}, err
|
||||
@ -255,13 +250,10 @@ func parseCookie(value core.Value) (drivers.HTTPCookie, error) {
|
||||
switch sameSite {
|
||||
case "lax":
|
||||
cookie.SameSite = drivers.SameSiteLaxMode
|
||||
break
|
||||
case "strict":
|
||||
cookie.SameSite = drivers.SameSiteStrictMode
|
||||
break
|
||||
default:
|
||||
cookie.SameSite = drivers.SameSiteDefaultMode
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user