mirror of
https://github.com/miniflux/v2.git
synced 2025-08-26 18:21:01 +00:00
fix: address minor issues detected by Go linters
This commit is contained in:
parent
febb7b1748
commit
31f0afe1ac
10 changed files with 31 additions and 25 deletions
|
@ -283,9 +283,10 @@ func isPixelTracker(tagName string, attributes []html.Attribute) bool {
|
|||
|
||||
for _, attribute := range attributes {
|
||||
if attribute.Val == "1" {
|
||||
if attribute.Key == "height" {
|
||||
switch attribute.Key {
|
||||
case "height":
|
||||
hasHeight = true
|
||||
} else if attribute.Key == "width" {
|
||||
case "width":
|
||||
hasWidth = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,10 +49,10 @@ func parseImageCandidate(input string) (*ImageCandidate, error) {
|
|||
parts := strings.Split(strings.TrimSpace(input), " ")
|
||||
nbParts := len(parts)
|
||||
|
||||
switch {
|
||||
case nbParts == 1:
|
||||
switch nbParts {
|
||||
case 1:
|
||||
return &ImageCandidate{ImageURL: parts[0]}, nil
|
||||
case nbParts == 2:
|
||||
case 2:
|
||||
if !isValidWidthOrDensityDescriptor(parts[1]) {
|
||||
return nil, fmt.Errorf(`srcset: invalid descriptor`)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue