diff --git a/.sage/go.mod b/.sage/go.mod index 3c06e95..d5791ee 100644 --- a/.sage/go.mod +++ b/.sage/go.mod @@ -2,4 +2,4 @@ module go.einride.tech/can/.sage go 1.19 -require go.einride.tech/sage v0.265.1 +require go.einride.tech/sage v0.268.0 diff --git a/.sage/go.sum b/.sage/go.sum index 565e8e3..87a80c8 100644 --- a/.sage/go.sum +++ b/.sage/go.sum @@ -1,2 +1,2 @@ -go.einride.tech/sage v0.265.1 h1:q3vZbehb1EqxjY2IsJNjIayBjBHU/uKD96fDz22rauM= -go.einride.tech/sage v0.265.1/go.mod h1:EzV5uciFX7/2ho8EKB5K9JghOfXIxlzs694b+Tkl5GQ= +go.einride.tech/sage v0.268.0 h1:/NKvKzhIis1izBHPwK4YbRWYLL5+q+oVOANt8Z7snWA= +go.einride.tech/sage v0.268.0/go.mod h1:EzV5uciFX7/2ho8EKB5K9JghOfXIxlzs694b+Tkl5GQ= diff --git a/cmd/cantool/main.go b/cmd/cantool/main.go index 433dacd..d0468ae 100644 --- a/cmd/cantool/main.go +++ b/cmd/cantool/main.go @@ -51,7 +51,7 @@ func generateCommand(app *kingpin.Application) { Arg("output-dir", "output directory"). Required(). String() - command.Action(func(c *kingpin.ParseContext) error { + command.Action(func(_ *kingpin.ParseContext) error { return filepath.Walk(*inputDir, func(p string, i os.FileInfo, err error) error { if err != nil { return err @@ -76,7 +76,7 @@ func lintCommand(app *kingpin.Application) { Arg("file-or-dir", "DBC file or directory"). Required(). ExistingFileOrDir() - command.Action(func(context *kingpin.ParseContext) error { + command.Action(func(_ *kingpin.ParseContext) error { filesToLint, err := resolveFileOrDirectory(*fileOrDir) if err != nil { return err @@ -176,7 +176,7 @@ func resolveFileOrDirectory(fileOrDirectory string) ([]string, error) { return []string{fileOrDirectory}, nil } var files []string - if err := filepath.Walk(fileOrDirectory, func(path string, info os.FileInfo, err error) error { + if err := filepath.Walk(fileOrDirectory, func(path string, info os.FileInfo, _ error) error { if !info.IsDir() && filepath.Ext(path) == ".dbc" { files = append(files, path) } diff --git a/data_test.go b/data_test.go index 752c2a7..de42d63 100644 --- a/data_test.go +++ b/data_test.go @@ -150,7 +150,7 @@ func TestData_LittleEndian(t *testing.T) { var data Data for j, signal := range tt.signals { j, signal := j, signal - t.Run(fmt.Sprintf("data:%v", j), func(t *testing.T) { + t.Run(fmt.Sprintf("data:%v", j), func(_ *testing.T) { data.SetUnsignedBitsLittleEndian(signal.start, signal.length, signal.unsigned) }) } @@ -160,7 +160,7 @@ func TestData_LittleEndian(t *testing.T) { var data Data for j, signal := range tt.signals { j, signal := j, signal - t.Run(fmt.Sprintf("data:%v", j), func(t *testing.T) { + t.Run(fmt.Sprintf("data:%v", j), func(_ *testing.T) { data.SetSignedBitsLittleEndian(signal.start, signal.length, signal.signed) }) } @@ -251,7 +251,7 @@ func TestData_BigEndian(t *testing.T) { var data Data for j, signal := range tt.signals { j, signal := j, signal - t.Run(fmt.Sprintf("data:%v", j), func(t *testing.T) { + t.Run(fmt.Sprintf("data:%v", j), func(_ *testing.T) { data.SetUnsignedBitsBigEndian(signal.start, signal.length, signal.unsigned) }) } @@ -261,7 +261,7 @@ func TestData_BigEndian(t *testing.T) { var data Data for j, signal := range tt.signals { j, signal := j, signal - t.Run(fmt.Sprintf("data:%v", j), func(t *testing.T) { + t.Run(fmt.Sprintf("data:%v", j), func(_ *testing.T) { data.SetSignedBitsBigEndian(signal.start, signal.length, signal.signed) }) } diff --git a/frame_json.go b/frame_json.go index e14ced6..043cd9d 100644 --- a/frame_json.go +++ b/frame_json.go @@ -21,6 +21,8 @@ type jsonFrame struct { // // {"id":32,"data":"0102030405060708"} // {"id":32,"extended":true,"remote":true,"length":4} +// +//nolint:goconst func (f Frame) JSON() string { switch { case f.IsRemote && f.IsExtended: diff --git a/internal/generate/example_test.go b/internal/generate/example_test.go index 99e412a..b095ee0 100644 --- a/internal/generate/example_test.go +++ b/internal/generate/example_test.go @@ -309,7 +309,7 @@ func TestExample_Node_NoEmptyMessages(t *testing.T) { motor := examplecan.NewMOTOR("can", "vcan0") // when starting them ctx, cancel := context.WithTimeout(context.Background(), testTimeout) - handler := func(ctx context.Context) error { + handler := func(_ context.Context) error { motor.Lock() motor.Tx().MotorStatus().SetSpeedKph(100).SetWheelError(true) motor.Unlock() diff --git a/internal/generate/file.go b/internal/generate/file.go index 8f10a35..3f9d300 100644 --- a/internal/generate/file.go +++ b/internal/generate/file.go @@ -749,6 +749,7 @@ func txGroupInterface(n *descriptor.Node) string { return n.Name + "_Tx" } +//nolint:goconst func txGroupStruct(n *descriptor.Node) string { return "xxx_" + n.Name + "_Tx" } diff --git a/pkg/socketcan/transmitter_test.go b/pkg/socketcan/transmitter_test.go index 25b7bb3..3539dd2 100644 --- a/pkg/socketcan/transmitter_test.go +++ b/pkg/socketcan/transmitter_test.go @@ -53,7 +53,7 @@ func TestTransmitter_TransmitMessage(t *testing.T) { // Frame Interceptor run := false - intFunc := func(fr can.Frame) { + intFunc := func(_ can.Frame) { run = true } testTransmit(TransmitterFrameInterceptor(intFunc))