remove outdated linter

remove redundant imports
remove deprecated and implicit rand seed init
adjust test
This commit is contained in:
Niko Storni 2024-04-09 20:00:46 +02:00
parent 14fbd2ae27
commit de736b068d
6 changed files with 9 additions and 15 deletions

View file

@ -28,8 +28,8 @@ before_script:
- go install github.com/fzipp/gocyclo/cmd/gocyclo@latest # Check against high complexity
- go install github.com/mdempsky/unconvert@latest # Identifies unnecessary type conversions
- go install github.com/kisielk/errcheck@latest # Checks for unhandled errors
- go install github.com/opennota/check/cmd/varcheck@latest # Checks for unused vars
- go install github.com/opennota/check/cmd/structcheck@latest # Checks for unused fields in structs
- go install gitlab.com/opennota/check/cmd/varcheck@latest # Checks for unused vars
- go install gitlab.com/opennota/check/cmd/structcheck@latest # Checks for unused fields in structs

View file

@ -15,7 +15,6 @@ import (
"github.com/lbryio/lbry.go/v2/stream"
"github.com/go-sql-driver/mysql"
_ "github.com/go-sql-driver/mysql" // blank import for db driver ensures its imported even if its not used
log "github.com/sirupsen/logrus"
"github.com/volatiletech/null/v8"
"go.uber.org/atomic"

View file

@ -8,7 +8,6 @@ import (
qt "github.com/lbryio/lbry.go/v2/extras/query"
"github.com/go-sql-driver/mysql"
_ "github.com/go-sql-driver/mysql" // blank import for db driver ensures its imported even if its not used
log "github.com/sirupsen/logrus"
"github.com/volatiletech/null/v8"
)

View file

@ -1,9 +1,6 @@
package main
import (
"math/rand"
"time"
"github.com/lbryio/reflector.go/cmd"
"github.com/google/gops/agent"
@ -14,6 +11,5 @@ func main() {
if err := agent.Listen(agent.Options{}); err != nil {
log.Fatal(err)
}
rand.Seed(time.Now().UnixNano())
cmd.Execute()
}

View file

@ -10,11 +10,10 @@ GO_FILES=$(find . -iname '*.go' -type f)
go install github.com/jgautheron/gocyclo@latest # Check against high complexity
go install github.com/mdempsky/unconvert@latest # Identifies unnecessary type conversions
go install github.com/kisielk/errcheck@latest # Checks for unhandled errors
go install github.com/opennota/check/cmd/varcheck@latest # Checks for unused vars
go install github.com/opennota/check/cmd/structcheck@latest # Checks for unused fields in structs
go install honnef.co/go/tools/cmd/staticcheck@latest # all sorts of static analysis
)
echo "Running varcheck..." && varcheck $(go list ./...)
echo "Running structcheck..." && structcheck $(go list ./...)
# echo "Running unused..." && staticcheck $(go list ./...)
# go vet is the official Go static analyzer
echo "Running go vet..." && go vet $(go list ./...)
# checks for unhandled errors

View file

@ -9,6 +9,7 @@ import (
"github.com/lbryio/reflector.go/shared"
"github.com/lbryio/lbry.go/v2/stream"
"github.com/sirupsen/logrus"
)
func TestCachingStore_Put(t *testing.T) {
@ -99,7 +100,7 @@ func TestCachingStore_ThunderingHerd(t *testing.T) {
getNoErr := func() {
res, _, err := s.Get(hash)
if err != nil {
t.Fatal(err)
logrus.Fatal(err)
}
if !bytes.Equal(b, res) {
t.Errorf("expected Get() to return %s, got %s", string(b), string(res))