Skip to content

Commit

Permalink
fixed linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mpapenbr committed Nov 26, 2023
1 parent 98359a2 commit 1e2bf68
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 31 deletions.
11 changes: 7 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,20 @@ linters-settings:
statements: 30

gci:
no-inline-comments: false
no-prefix-comments: false
# no-inline-comments: false
# no-prefix-comments: false

# sorts imports with prefix after 3rd-party packages; supports only one prefix - if
# not set, uses goimports.local-prefixes
sections:
- standard # standard packages
- default # all other imports that do not fall in any group
- prefix(github.com/mpapenbr/go-racelogger) # internal imports from `go-racelogger`
section-separators:
- newLine
- blank
- dot
# section-separators:
# - newLine
custom-order: true

gocognit:
# minimal code complexity to report, 30 by default (recommended 10-20)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (

require (
github.com/google/uuid v1.4.0
github.com/mpapenbr/goirsdk v0.4.3
github.com/mpapenbr/goirsdk v0.4.4
github.com/mpapenbr/iracelog-service-manager-go v0.9.0
github.com/samber/lo v1.38.1
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/mpapenbr/goirsdk v0.4.3 h1:e7KaBkSTV52i1DDVrtUZGRTpf3w7q6UQggKyq1VBAoA=
github.com/mpapenbr/goirsdk v0.4.3/go.mod h1:kpfWPfgIZSncRdxqWuyJ/aOnaFHJbSg3XqQvbgA63lo=
github.com/mpapenbr/goirsdk v0.4.4 h1:q5mafqlCASKkWd/gI9T4JNFNoLl2wRz4EnXYdopirOg=
github.com/mpapenbr/goirsdk v0.4.4/go.mod h1:kpfWPfgIZSncRdxqWuyJ/aOnaFHJbSg3XqQvbgA63lo=
github.com/mpapenbr/iracelog-service-manager-go v0.9.0 h1:yPnRqLjK6mtXyNWYub+ezeLUMAUba0mgkvskK6iWuME=
github.com/mpapenbr/iracelog-service-manager-go v0.9.0/go.mod h1:nFt83bG1Az6PzbOa3fl3Mnw9QIaSWhyMREESOY4ju1Y=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
Expand Down
3 changes: 2 additions & 1 deletion internal/processor/cardata.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package processor
import (
"fmt"

"github.com/mpapenbr/go-racelogger/log"
"github.com/mpapenbr/goirsdk/irsdk"

"github.com/mpapenbr/go-racelogger/log"
)

type carState interface {
Expand Down
3 changes: 2 additions & 1 deletion internal/processor/cars.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"reflect"
"sort"

"github.com/mpapenbr/go-racelogger/log"
"github.com/mpapenbr/goirsdk/irsdk"
"github.com/mpapenbr/goirsdk/yaml"
"golang.org/x/exp/slices"

"github.com/mpapenbr/go-racelogger/log"
)

// this struct is responsible for processing overall car data.
Expand Down
15 changes: 8 additions & 7 deletions internal/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (
"time"

"github.com/google/go-cmp/cmp"
"github.com/mpapenbr/go-racelogger/log"
"github.com/mpapenbr/goirsdk/irsdk"
"github.com/mpapenbr/goirsdk/yaml"
iryaml "github.com/mpapenbr/goirsdk/yaml"
"github.com/mpapenbr/iracelog-service-manager-go/pkg/model"
goyaml "gopkg.in/yaml.v3"
"gopkg.in/yaml.v3"

"github.com/mpapenbr/go-racelogger/log"
)

type (
Expand Down Expand Up @@ -88,7 +89,7 @@ type Processor struct {
raceProc *RaceProc
messageProc *MessageProc
pitBoundaryProc *PitBoundaryProc
lastDriverInfo yaml.DriverInfo
lastDriverInfo iryaml.DriverInfo
stateOutput chan model.StateData
speedmapOutput chan model.SpeedmapData
extraInfoOutput chan model.ExtraInfo
Expand Down Expand Up @@ -182,10 +183,10 @@ func (p *Processor) Process() {
!cmp.Equal(y.DriverInfo, p.lastDriverInfo) {

log.Info("DriverInfo changed, updating state")
var freshYaml yaml.IrsdkYaml
if err := goyaml.Unmarshal([]byte(p.api.GetYamlString()), &freshYaml); err != nil {
var freshYaml iryaml.IrsdkYaml
if err := yaml.Unmarshal([]byte(p.api.GetYamlString()), &freshYaml); err != nil {
// let's try to repair the yaml and unmarshal again
err := goyaml.Unmarshal([]byte(p.api.RepairedYaml(p.api.GetYamlString())),
err := yaml.Unmarshal([]byte(p.api.RepairedYaml(p.api.GetYamlString())),
&freshYaml)
if err != nil {
log.Error("Error unmarshalling irsdk yaml", log.ErrorField(err))
Expand Down
3 changes: 2 additions & 1 deletion internal/processor/race.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ package processor
import (
"time"

"github.com/mpapenbr/go-racelogger/log"
"github.com/mpapenbr/goirsdk/irsdk"

"github.com/mpapenbr/go-racelogger/log"
)

type raceState interface {
Expand Down
3 changes: 2 additions & 1 deletion internal/processor/speedmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"fmt"
"math"

"github.com/mpapenbr/go-racelogger/log"
"github.com/mpapenbr/goirsdk/irsdk"
"github.com/mpapenbr/iracelog-service-manager-go/pkg/model"
"github.com/samber/lo"
"golang.org/x/exp/slices"

"github.com/mpapenbr/go-racelogger/log"
)

// collects speed data for a chunk of track
Expand Down
3 changes: 2 additions & 1 deletion internal/processor/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import (
"strconv"
"time"

"github.com/mpapenbr/go-racelogger/log"
"github.com/mpapenbr/goirsdk/irsdk"
"github.com/mpapenbr/goirsdk/yaml"
"github.com/mpapenbr/iracelog-service-manager-go/pkg/model"
"golang.org/x/exp/slices"

"github.com/mpapenbr/go-racelogger/log"
)

var ErrUnknownValueWithUnit = errors.New("Unknown value with unit format")
Expand Down
10 changes: 5 additions & 5 deletions internal/racelogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import (
"time"

"github.com/google/uuid"
"github.com/mpapenbr/goirsdk/irsdk"
"github.com/mpapenbr/goirsdk/yaml"
"github.com/mpapenbr/iracelog-service-manager-go/pkg/model"
"github.com/mpapenbr/iracelog-service-manager-go/pkg/service"
goyaml "gopkg.in/yaml.v3"

"github.com/mpapenbr/go-racelogger/internal/processor"
"github.com/mpapenbr/go-racelogger/log"
"github.com/mpapenbr/go-racelogger/pkg/config"
"github.com/mpapenbr/go-racelogger/pkg/wamp"
"github.com/mpapenbr/go-racelogger/version"
"github.com/mpapenbr/goirsdk/irsdk"
"github.com/mpapenbr/goirsdk/yaml"
"github.com/mpapenbr/iracelog-service-manager-go/pkg/model"
"github.com/mpapenbr/iracelog-service-manager-go/pkg/service"
goyaml "gopkg.in/yaml.v3"
)

type (
Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/ping/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package ping
import (
"fmt"

"github.com/spf13/cobra"

"github.com/mpapenbr/go-racelogger/log"
"github.com/mpapenbr/go-racelogger/pkg/config"
"github.com/mpapenbr/go-racelogger/pkg/util"
"github.com/mpapenbr/go-racelogger/pkg/wamp"
"github.com/spf13/cobra"
)

func NewPingCmd() *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/record/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"os"
"os/signal"

"github.com/spf13/cobra"

"github.com/mpapenbr/go-racelogger/internal"
"github.com/mpapenbr/go-racelogger/log"
"github.com/mpapenbr/go-racelogger/pkg/config"
"github.com/mpapenbr/go-racelogger/pkg/util"
"github.com/mpapenbr/go-racelogger/pkg/wamp"
"github.com/spf13/cobra"
)

var (
Expand Down
7 changes: 3 additions & 4 deletions pkg/cmd/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import (
"errors"
"fmt"

"github.com/mpapenbr/goirsdk/irsdk"
"github.com/spf13/cobra"

"github.com/mpapenbr/go-racelogger/log"
"github.com/mpapenbr/go-racelogger/pkg/config"
"github.com/mpapenbr/go-racelogger/pkg/util"

"github.com/mpapenbr/goirsdk/irsdk"

"github.com/spf13/cobra"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion pkg/util/simulationcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package util
import (
"time"

"github.com/mpapenbr/goirsdk/irsdk"

"github.com/mpapenbr/go-racelogger/log"
"github.com/mpapenbr/go-racelogger/pkg/config"
"github.com/mpapenbr/goirsdk/irsdk"
)

func WaitForSimulation() bool {
Expand Down

0 comments on commit 1e2bf68

Please sign in to comment.