mirror of
https://github.com/Luzifer/go-latestver.git
synced 2024-12-20 10:31:16 +00:00
Lint: Fix linter errors
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
8e79d09d5f
commit
368c936c32
6 changed files with 10 additions and 11 deletions
2
api.go
2
api.go
|
@ -136,7 +136,7 @@ func handleCatalogGetVersion(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
fmt.Fprint(w, cm.CurrentVersion)
|
||||
fmt.Fprint(w, cm.CurrentVersion) //nolint:errcheck
|
||||
}
|
||||
|
||||
func handleCatalogList(w http.ResponseWriter, _ *http.Request) {
|
||||
|
|
|
@ -46,7 +46,7 @@ func Create(title, text, color string) []byte {
|
|||
titleW, _ := calculateTextWidth(title)
|
||||
textW, _ := calculateTextWidth(text)
|
||||
|
||||
width := titleW + textW + 4*xSpacing //nolint:gomnd
|
||||
width := titleW + textW + 4*xSpacing //nolint:mnd
|
||||
|
||||
t, _ := assets.ReadFile("badge.svg.tpl")
|
||||
tpl, _ := template.New("svg").Parse(string(t))
|
||||
|
|
|
@ -118,4 +118,6 @@ func (c Client) initDB() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (l logwrap) Printf(f string, v ...interface{}) { fmt.Fprintf(l.l, f, v...) }
|
||||
func (l logwrap) Printf(f string, v ...interface{}) {
|
||||
fmt.Fprintf(l.l, f, v...) //nolint:errcheck
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ func (HTMLFetcher) FetchVersion(_ context.Context, attrs *fieldcollection.FieldC
|
|||
}
|
||||
|
||||
match := regexp.MustCompile(attrs.MustString("regex", &htmlFetcherDefaultRegex)).FindStringSubmatch(node.Data)
|
||||
if len(match) < 2 { //nolint:gomnd // Simple count of fields, no need for constant
|
||||
if len(match) < 2 { //nolint:mnd // Simple count of fields, no need for constant
|
||||
return "", time.Time{}, errors.New("regular expression did not yield version")
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ func (JSONFetcher) FetchVersion(ctx context.Context, attrs *fieldcollection.Fiel
|
|||
}
|
||||
|
||||
match := regexp.MustCompile(attrs.MustString("regex", &jsonFetcherDefaultRegex)).FindStringSubmatch(node.Data)
|
||||
if len(match) < 2 { //nolint:gomnd // Simple count of fields, no need for constant
|
||||
if len(match) < 2 { //nolint:mnd // Simple count of fields, no need for constant
|
||||
return "", time.Time{}, errors.New("regular expression did not yield version")
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package main
|
|||
import (
|
||||
"context"
|
||||
"crypto/md5" //#nosec G501 // Used to derive a static jitter checksum, not cryptographically
|
||||
"fmt"
|
||||
"math"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -120,12 +119,10 @@ func nextCheckTime(ce *database.CatalogEntry, lastCheck *time.Time) time.Time {
|
|||
return time.Now()
|
||||
}
|
||||
|
||||
hash := md5.New() //#nosec G401 // Used to derive a static jitter checksum, not cryptographically
|
||||
fmt.Fprint(hash, ce.Key())
|
||||
|
||||
var jitter int64
|
||||
for i, c := range hash.Sum(nil) {
|
||||
jitter += int64(c) * int64(math.Pow(10, float64(i))) //nolint:gomnd // No need for constant here
|
||||
//#nosec G401 // Used to derive a static jitter checksum, not cryptographically
|
||||
for i, c := range md5.Sum([]byte(ce.Key())) {
|
||||
jitter += int64(c) * int64(math.Pow(10, float64(i))) //nolint:mnd // No need for constant here
|
||||
}
|
||||
|
||||
next := lastCheck.
|
||||
|
|
Loading…
Reference in a new issue