Skip to content

Commit

Permalink
Some more staticcheck fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Aug 19, 2024
1 parent b6c4db4 commit c6e8967
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
5 changes: 1 addition & 4 deletions cmd/goatcounter/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,7 @@ func persistLog(hits <-chan handlers.APICountRequestHit, url, key string, silent
}
}

var (
importClient = http.Client{Timeout: 5 * time.Second}
nSent int64
)
var importClient = http.Client{Timeout: 5 * time.Second}

func importSend(url, key string, silent, follow bool, hits []handlers.APICountRequestHit) error {
body, err := json.Marshal(handlers.APICountRequest{NoSessions: true, Hits: hits})
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/gomig/2022-11-15-1-correct-hit-stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,5 @@ type Hit struct {
SystemID int64 `db:"-" json:"-"`

// Don't process in memstore; for merging paths.
noProcess bool `db:"-" json:"-"`
//noProcess bool `db:"-" json:"-"`
}
1 change: 1 addition & 0 deletions handlers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type (
Errors map[string][]string `json:"errors,omitempty"`
}
// Authentication error: the API key was not provided or incorrect.
//lint:ignore U1000 referenced from Kommentaar.
authError struct {
Error string `json:"error,omitempty"`
}
Expand Down
18 changes: 9 additions & 9 deletions hit_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,20 +217,20 @@ func (h *HitStats) ListSizes(ctx context.Context, rng ztime.Range, pathFilter []
// ListSize lists all sizes for one grouping.
func (h *HitStats) ListSize(ctx context.Context, id string, rng ztime.Range, pathFilter []int64, limit, offset int) error {
var (
min_size, max_size int
empty bool
minSize, maxSize int
empty bool
)
switch id {
case sizePhones:
max_size = 384
maxSize = 384
case sizeLargePhones:
min_size, max_size = 384, 1024
minSize, maxSize = 384, 1024
case sizeTablets:
min_size, max_size = 1024, 1440
minSize, maxSize = 1024, 1440
case sizeDesktop:
min_size, max_size = 1440, 1920
minSize, maxSize = 1440, 1920
case sizeDesktopHD:
min_size, max_size = 1920, 99999
minSize, maxSize = 1920, 99999
case sizeUnknown:
empty = true
default:
Expand All @@ -243,8 +243,8 @@ func (h *HitStats) ListSize(ctx context.Context, id string, rng ztime.Range, pat
"start": asUTCDate(user, rng.Start),
"end": asUTCDate(user, rng.End),
"filter": pathFilter,
"min_size": min_size,
"max_size": max_size,
"min_size": minSize,
"max_size": maxSize,
"empty": empty,
"limit": limit + 1,
"offset": offset,
Expand Down
4 changes: 0 additions & 4 deletions logscan/regex_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,6 @@ func toI64(s string) int64 {
n, _ := strconv.ParseInt(s, 10, 64)
return n
}
func toUi64(s string) uint64 {
n, _ := strconv.ParseUint(s, 10, 64)
return n
}

var _ Line = RegexLine{}

Expand Down
7 changes: 6 additions & 1 deletion staticcheck.conf
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
checks = ['all', '-ST1000', '-ST1003', '-ST1020', '-ST1021', '-SA9003', '-U1000', '-SA5008']
checks = [
'all',
'-ST1000', # "Must have at least one package comment"
'-ST1020', '-ST1021', # "Documentation must start with {function,type} name"
'-SA5008', # We have our own json package, will error on 'unknown JSON option "readonly"'
]

0 comments on commit c6e8967

Please sign in to comment.