Skip to content

Commit 7677830

Browse files
committed
Update golangcilint config and fix minor remarks
1 parent 03785c6 commit 7677830

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed

.golangci.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ linters:
22
enable-all: true
33
disable:
44
## These are deprecated
5-
- execinquery
65
- exportloopref
7-
- gomnd
86

97
## These are too strict for our taste
108
# Whitespace linter
@@ -23,7 +21,13 @@ linters:
2321
# I don't really care about cyclopmatic complexity
2422
- cyclop
2523
- gocognit
26-
24+
# I don't see the harm in returning an interface
25+
- ireturn
26+
# Too many false positives, due to easyjson rn
27+
- recvcheck
28+
# While aligned tags look nice, i can't be arsed doing it manually.
29+
- tagalign
30+
2731
## Useful, but we won't use it for now, maybe later
2832
# Allows us to define rules for dependencies
2933
- depguard
@@ -61,6 +65,12 @@ linters-settings:
6165
# This has false positives and provides little value.
6266
- ifElseChain
6367

68+
gosec:
69+
excludes:
70+
# weak number generator stuff; mostly false positives, as we don't do
71+
# security sensitive things anyway.
72+
- G404
73+
6474
revive:
6575
rules:
6676
- name: var-naming

internal/api/createparse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func parseIntValue(toParse string, lower, upper int, valueName string) (int, err
135135
// ParseBoolean checks whether the given value is either "true" or "false".
136136
// The checks are case-insensitive. If an empty string is supplied, false
137137
// is returned. All other invalid input will return an error.
138-
func ParseBoolean(valueName string, value string) (bool, error) {
138+
func ParseBoolean(valueName, value string) (bool, error) {
139139
if value == "" {
140140
return false, nil
141141
}

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type Config struct {
5252
RootPath string `env:"ROOT_PATH"`
5353
// RootURL is similar to RootPath, but contains only the protocol and
5454
// domain. So it could be https://painting.com. This is required for some
55-
// non critical functionallity, such as metadata tags.
55+
// non critical functionality, such as metadata tags.
5656
RootURL string `env:"ROOT_URL"`
5757
CPUProfilePath string `env:"CPU_PROFILE_PATH"`
5858
// LobbySettingDefaults is used for the server side rendering of the lobby

internal/frontend/http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type BasePageConfig struct {
4242
RootPath string `json:"rootPath"`
4343
// RootURL is similar to RootPath, but contains only the protocol and
4444
// domain. So it could be https://painting.com. This is required for some
45-
// non critical functionallity, such as metadata tags.
45+
// non critical functionality, such as metadata tags.
4646
RootURL string `json:"rootUrl"`
4747
// CacheBust is a string that is appended to all resources to prevent
4848
// browsers from using cached data of a previous version, but still have

internal/game/lobby.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,11 +1146,11 @@ func (lobby *Lobby) Shutdown() {
11461146
lobby.Broadcast(&EventTypeOnly{Type: EventTypeShutdown})
11471147
}
11481148

1149-
// ScoreCalculation allows having different scoring systems for
1149+
// ScoreCalculation allows having different scoring systems for a lobby.
11501150
type ScoreCalculation interface {
11511151
Identifier() string
1152-
CalculateGuesserScore(*Lobby) int
1153-
CalculateDrawerScore(*Lobby) int
1152+
CalculateGuesserScore(lobby *Lobby) int
1153+
CalculateDrawerScore(lobby *Lobby) int
11541154
}
11551155

11561156
var ChillScoring = &adjustableScoringAlgorithm{

internal/version/version.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package version
44

55
import (
6-
"fmt"
76
"regexp"
87
)
98

@@ -20,9 +19,8 @@ func init() {
2019

2120
if Version != "dev" {
2221
// version-commit_count_after_version-hash
23-
hashRegex := regexp.MustCompile("v.+?(?:-\\d+?-g(.+?)(?:$|-))")
22+
hashRegex := regexp.MustCompile(`v.+?(?:-\d+?-g(.+?)(?:$|-))`)
2423
match := hashRegex.FindStringSubmatch(Version)
25-
fmt.Println(match, len(match))
2624
if len(match) == 2 {
2725
Commit = match[1]
2826
}

0 commit comments

Comments
 (0)