From 512a43c444a8fc94e15ffce0adf9d89f2b3f72e3 Mon Sep 17 00:00:00 2001 From: Kevin Joiner <10265309+KevinJoiner@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:51:37 -0400 Subject: [PATCH] linter fixes --- .golangci.yml | 3 - cmd/clickhouse-container/main.go | 2 +- cmd/codegen/codegen.go | 6 +- internal/codegen/convert/convert.go | 3 +- internal/codegen/convert/convertFunc.go | 18 +- internal/codegen/graphql/graphql.go | 1 - internal/codegen/migration/migration.go | 1 + internal/codegen/signal.go | 2 + pkg/clickhouseinfra/clickhouseinfra.go | 12 +- pkg/migrations/20240402091429_init.go | 1 + pkg/runner/runner.go | 2 + pkg/vss/convert/payloadv1.go | 1 + pkg/vss/convert/payloadv1_test.go | 383 ++++++++++++------------ pkg/vss/convert/payloadv2.go | 4 - pkg/vss/convert/payloadv2_test.go | 5 +- pkg/vss/signal.go | 1 + schema/embed.go | 4 + 17 files changed, 231 insertions(+), 218 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index ecdd81b..5986c39 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -23,14 +23,11 @@ linters: disable-all: true enable: - bodyclose - - dogsled - dupl - errcheck - exportloopref - funlen - gocritic - - goconst - - gocyclo - gofumpt - goimports - revive diff --git a/cmd/clickhouse-container/main.go b/cmd/clickhouse-container/main.go index 7280ef1..ef640a7 100644 --- a/cmd/clickhouse-container/main.go +++ b/cmd/clickhouse-container/main.go @@ -34,7 +34,7 @@ func run(ctx context.Context) error { defer chcontainer.Terminate(ctx) if *migrate { - db, err := clickhouseinfra.GetClickhouseAsDB(ctx, chcontainer.ClickHouseContainer) + db, err := clickhouseinfra.GetClickhouseAsDB(ctx, chcontainer.ClickHouseContainer) //nolint: govet // false positive if err != nil { return fmt.Errorf("failed to get clickhouse db: %w", err) } diff --git a/cmd/codegen/codegen.go b/cmd/codegen/codegen.go index 07601d1..fb0774d 100644 --- a/cmd/codegen/codegen.go +++ b/cmd/codegen/codegen.go @@ -46,7 +46,8 @@ func main() { if *definitionPath != "" { f, err := os.Open(filepath.Clean(*definitionPath)) if err != nil { - log.Fatalf("failed to open file: %v", err) + defer log.Fatalf("failed to open file: %v", err) + return } definitionReader = f //nolint:errcheck // we don't care about the error since we are not writing to the file @@ -70,6 +71,7 @@ func main() { err := runner.Execute(vspecReader, definitionReader, gens, cfg) if err != nil { - log.Fatal(err) + defer log.Fatal(err) + return } } diff --git a/internal/codegen/convert/convert.go b/internal/codegen/convert/convert.go index 308454d..2c045da 100644 --- a/internal/codegen/convert/convert.go +++ b/internal/codegen/convert/convert.go @@ -27,7 +27,7 @@ const ( convertTestFuncFileNameFormat = "%s-convert-funcs_test.go" ) -type ConversionData struct { +type conversionData struct { Signal *codegen.SignalInfo convIdx int } @@ -51,6 +51,7 @@ const header = `package %s // Code generated by model-garage. ` +// Config is the configuration for the conversion generator. type Config struct { // WithTest determines if test functions should be generated. WithTest bool diff --git a/internal/codegen/convert/convertFunc.go b/internal/codegen/convert/convertFunc.go index bfb77a2..9a0e080 100644 --- a/internal/codegen/convert/convertFunc.go +++ b/internal/codegen/convert/convertFunc.go @@ -15,7 +15,7 @@ import ( "github.com/DIMO-Network/model-garage/internal/codegen" ) -func createConvertFuncs(tmplData *codegen.TemplateData, outputDir string, needsConvertFunc []ConversionData) error { +func createConvertFuncs(tmplData *codegen.TemplateData, outputDir string, needsConvertFunc []conversionData) error { convertFuncTemplate, err := createConvertFuncTemplate() if err != nil { return err @@ -34,22 +34,22 @@ func createConvertFuncs(tmplData *codegen.TemplateData, outputDir string, needsC } // getConversionFunctions returns the signals that need conversion functions and test functions. -func getConversionFunctions(signals []*codegen.SignalInfo, existingFuncs map[string]bool) ([]ConversionData, []ConversionData) { - var needsConvertFunc []ConversionData - var needsConvertTestFunc []ConversionData +func getConversionFunctions(signals []*codegen.SignalInfo, existingFuncs map[string]bool) ([]conversionData, []conversionData) { + var needsConvertFunc []conversionData + var needsConvertTestFunc []conversionData for _, signal := range signals { if len(signal.Conversions) == 0 { continue } - for i, _ := range signal.Conversions { + for i := range signal.Conversions { funcName := convertName(signal) + strconv.Itoa(i) if !existingFuncs[funcName] { - convData := ConversionData{Signal: signal, convIdx: i} + convData := conversionData{Signal: signal, convIdx: i} needsConvertFunc = append(needsConvertFunc, convData) } funcName = convertTestName(signal) + strconv.Itoa(i) if !existingFuncs[funcName] { - convData := ConversionData{Signal: signal, convIdx: i} + convData := conversionData{Signal: signal, convIdx: i} needsConvertTestFunc = append(needsConvertTestFunc, convData) } } @@ -58,7 +58,7 @@ func getConversionFunctions(signals []*codegen.SignalInfo, existingFuncs map[str } // createConvertTestFunc creates test functions for the conversion functions if they do not exist. -func createConvertTestFunc(tmplData *codegen.TemplateData, outputDir string, needsConvertTestFunc []ConversionData) error { +func createConvertTestFunc(tmplData *codegen.TemplateData, outputDir string, needsConvertTestFunc []conversionData) error { convertTestFuncTemplate, err := createConvertTestFuncTemplate(tmplData.PackageName) if err != nil { return err @@ -173,7 +173,7 @@ func ensureFuncFile(convertFuncPath string, packageName string) error { return nil } -func writeConvertFuncs(needsConvertFunc []ConversionData, tmpl *template.Template, outputPath string, packageName string) error { +func writeConvertFuncs(needsConvertFunc []conversionData, tmpl *template.Template, outputPath string, packageName string) error { // check if we need to create convertFunc file err := ensureFuncFile(outputPath, packageName) if err != nil { diff --git a/internal/codegen/graphql/graphql.go b/internal/codegen/graphql/graphql.go index 6e877c2..1630027 100644 --- a/internal/codegen/graphql/graphql.go +++ b/internal/codegen/graphql/graphql.go @@ -2,7 +2,6 @@ package graphql import ( - _ "embed" "fmt" "os" "path" diff --git a/internal/codegen/migration/migration.go b/internal/codegen/migration/migration.go index cc54ac0..35497fb 100644 --- a/internal/codegen/migration/migration.go +++ b/internal/codegen/migration/migration.go @@ -1,3 +1,4 @@ +// Package migration provides a function for migrating a clickhouse database to a schema. package migration import ( diff --git a/internal/codegen/signal.go b/internal/codegen/signal.go index 767a84c..dcc9a38 100644 --- a/internal/codegen/signal.go +++ b/internal/codegen/signal.go @@ -175,11 +175,13 @@ func chName(name string) string { return strings.ReplaceAll(removePrefix(name), ".", "_") } +// JSONName returns the json name of the signal. func JSONName(name string) string { n := goName(name) // lowercase the first letter return strings.ToLower(n[:1]) + n[1:] } + func removePrefix(name string) string { idx := strings.IndexByte(name, '.') if idx != -1 { diff --git a/pkg/clickhouseinfra/clickhouseinfra.go b/pkg/clickhouseinfra/clickhouseinfra.go index 26f5767..fbcfd8a 100644 --- a/pkg/clickhouseinfra/clickhouseinfra.go +++ b/pkg/clickhouseinfra/clickhouseinfra.go @@ -1,3 +1,4 @@ +// Package clickhouseinfra provides a set of functions to interact with ClickHouse containers. package clickhouseinfra import ( @@ -20,6 +21,8 @@ type ColInfo struct { Type string Comment string } + +// Container is a struct that holds the clickhouse and zookeeper containers. type Container struct { *chmodule.ClickHouseContainer ZooKeeperContainer testcontainers.Container @@ -37,7 +40,7 @@ func CreateClickHouseContainer(ctx context.Context, userName, password string) ( } ipaddr, err := zkcontainer.ContainerIP(ctx) if err != nil { - zkcontainer.Terminate(ctx) + _ = zkcontainer.Terminate(ctx) return nil, fmt.Errorf("failed to get zookeeper container IP: %w", err) } clickHouseContainer, err := chmodule.RunContainer(ctx, @@ -48,7 +51,7 @@ func CreateClickHouseContainer(ctx context.Context, userName, password string) ( chmodule.WithZookeeper(ipaddr, zkPort), ) if err != nil { - zkcontainer.Terminate(ctx) + _ = zkcontainer.Terminate(ctx) return nil, fmt.Errorf("failed to start clickhouse container: %w", err) } return &Container{clickHouseContainer, zkcontainer}, nil @@ -94,7 +97,7 @@ func GetClickhouseAsDB(ctx context.Context, container *chmodule.ClickHouseContai return dbConn, nil } -// Terminate function terminates the clickhouse container. +// Terminate function terminates the clickhouse and zookeeper containers. // If an error occurs, it will be printed to stderr. func (c *Container) Terminate(ctx context.Context) { if err := c.ClickHouseContainer.Terminate(ctx); err != nil { @@ -112,7 +115,7 @@ func GetCurrentCols(ctx context.Context, chConn clickhouse.Conn, tableName strin if err != nil { return nil, fmt.Errorf("failed to show table: %w", err) } - defer rows.Close() + defer rows.Close() //nolint // we are not interested in the error here colInfos := []ColInfo{} count := 0 for rows.Next() { @@ -127,6 +130,7 @@ func GetCurrentCols(ctx context.Context, chConn clickhouse.Conn, tableName strin return colInfos, nil } +// StartZooKeeperContainer function starts a zookeeper container. The caller is responsible for terminating the container. func StartZooKeeperContainer(ctx context.Context) (testcontainers.Container, string, error) { zkPort := nat.Port("2181/tcp") diff --git a/pkg/migrations/20240402091429_init.go b/pkg/migrations/20240402091429_init.go index 863d6a6..146bb90 100644 --- a/pkg/migrations/20240402091429_init.go +++ b/pkg/migrations/20240402091429_init.go @@ -35,6 +35,7 @@ func downInit(ctx context.Context, tx *sql.Tx) error { return nil } +//nolint:misspell // false positive const createDIMOtableStatement = `CREATE TABLE IF NOT EXISTS dimo ( DefinitionID String COMMENT 'ID for the vehicles definition', Source String COMMENT 'where the data was sourced from', diff --git a/pkg/runner/runner.go b/pkg/runner/runner.go index d75d512..1bd0fa9 100644 --- a/pkg/runner/runner.go +++ b/pkg/runner/runner.go @@ -1,3 +1,4 @@ +// Package runner is a package that provides a programmatic interface to the code generation tool. package runner import ( @@ -25,6 +26,7 @@ const ( MigrationGenerator = "migration" ) +// Config is the configuration for the code generation tool. type Config struct { PackageName string OutputDir string diff --git a/pkg/vss/convert/payloadv1.go b/pkg/vss/convert/payloadv1.go index a6a5fbc..444e77c 100644 --- a/pkg/vss/convert/payloadv1.go +++ b/pkg/vss/convert/payloadv1.go @@ -1,3 +1,4 @@ +// Package convert provides a function to generate conversion functions for a vehicle struct. package convert import ( diff --git a/pkg/vss/convert/payloadv1_test.go b/pkg/vss/convert/payloadv1_test.go index e42630c..bc4b146 100644 --- a/pkg/vss/convert/payloadv1_test.go +++ b/pkg/vss/convert/payloadv1_test.go @@ -29,7 +29,8 @@ func TestFullFromDataConversion(t *testing.T) { require.Equalf(t, expectedSignals, actualSignals, "converted vehicle does not match expected vehicle") } -var fullInputJSON = `{ +var ( + fullInputJSON = `{ "id": "randomIDnumber", "specversion": "1.0", "source": "SensorXYZ", @@ -74,193 +75,193 @@ var fullInputJSON = `{ "vin": "1234567890" }, }` - -var ts = time.Date(2022, 1, 1, 12, 34, 56, 0, time.UTC) -var expectedSignals = []vss.Signal{ - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["chassisAxleRow1WheelLeftTirePressure"], - ValueNumber: 30.5, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["chassisAxleRow1WheelRightTirePressure"], - ValueNumber: 31, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["chassisAxleRow2WheelLeftTirePressure"], - ValueNumber: 32.2, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["chassisAxleRow2WheelRightTirePressure"], - ValueNumber: 33.1, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["currentLocationAltitude"], - ValueNumber: 100, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["currentLocationLatitude"], - ValueNumber: 37.7749, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["currentLocationLongitude"], - ValueNumber: -122.4194, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["currentLocationTimestamp"], - ValueNumber: float64(ts.UTC().Unix()), - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["powertrainCombustionEngineECT"], - ValueNumber: 90, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["powertrainCombustionEngineEngineOilLevel"], - ValueString: "CRITICALLY_LOW", - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["powertrainCombustionEngineSpeed"], - ValueNumber: 3000, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["powertrainCombustionEngineTPS"], - ValueNumber: 50, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["powertrainFuelSystemAbsoluteLevel"], - ValueNumber: 60, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["powertrainFuelSystemSupportedFuelTypes"], - ValueString: "GASOLINE", - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["powertrainRange"], - ValueNumber: 300, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["powertrainType"], - ValueString: "COMBUSTION", - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["powertrainTractionBatteryChargingChargeLimit"], - ValueNumber: 80, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["powertrainTractionBatteryChargingIsCharging"], - ValueNumber: 1, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["powertrainTractionBatteryGrossCapacity"], - ValueNumber: 60, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["powertrainTractionBatteryStateOfChargeCurrent"], - ValueNumber: 70, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["powertrainTransmissionTravelledDistance"], - ValueNumber: 50000, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["speed"], - ValueNumber: 60, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["vehicleIdentificationBrand"], - ValueString: "Toyota", - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["vehicleIdentificationModel"], - ValueString: "Camry", - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["vehicleIdentificationYear"], - ValueNumber: 2020, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["exteriorAirTemperature"], - ValueNumber: 25, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["lowVoltageBatteryCurrentVoltage"], - ValueNumber: 12.5, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["oBDBarometricPressure"], - ValueNumber: 1013.25, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["oBDEngineLoad"], - ValueNumber: 75, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["oBDIntakeTemp"], - ValueNumber: 30, - }, - { - TokenID: 123, - Timestamp: ts, - Name: vss.JSONName2CHName["oBDRunTime"], - ValueNumber: 1200, - }, -} + ts = time.Date(2022, 1, 1, 12, 34, 56, 0, time.UTC) + expectedSignals = []vss.Signal{ + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["chassisAxleRow1WheelLeftTirePressure"], + ValueNumber: 30.5, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["chassisAxleRow1WheelRightTirePressure"], + ValueNumber: 31, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["chassisAxleRow2WheelLeftTirePressure"], + ValueNumber: 32.2, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["chassisAxleRow2WheelRightTirePressure"], + ValueNumber: 33.1, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["currentLocationAltitude"], + ValueNumber: 100, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["currentLocationLatitude"], + ValueNumber: 37.7749, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["currentLocationLongitude"], + ValueNumber: -122.4194, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["currentLocationTimestamp"], + ValueNumber: float64(ts.UTC().Unix()), + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["powertrainCombustionEngineECT"], + ValueNumber: 90, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["powertrainCombustionEngineEngineOilLevel"], + ValueString: "CRITICALLY_LOW", + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["powertrainCombustionEngineSpeed"], + ValueNumber: 3000, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["powertrainCombustionEngineTPS"], + ValueNumber: 50, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["powertrainFuelSystemAbsoluteLevel"], + ValueNumber: 60, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["powertrainFuelSystemSupportedFuelTypes"], + ValueString: "GASOLINE", + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["powertrainRange"], + ValueNumber: 300, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["powertrainType"], + ValueString: "COMBUSTION", + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["powertrainTractionBatteryChargingChargeLimit"], + ValueNumber: 80, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["powertrainTractionBatteryChargingIsCharging"], + ValueNumber: 1, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["powertrainTractionBatteryGrossCapacity"], + ValueNumber: 60, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["powertrainTractionBatteryStateOfChargeCurrent"], + ValueNumber: 70, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["powertrainTransmissionTravelledDistance"], + ValueNumber: 50000, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["speed"], + ValueNumber: 60, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["vehicleIdentificationBrand"], + ValueString: "Toyota", + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["vehicleIdentificationModel"], + ValueString: "Camry", + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["vehicleIdentificationYear"], + ValueNumber: 2020, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["exteriorAirTemperature"], + ValueNumber: 25, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["lowVoltageBatteryCurrentVoltage"], + ValueNumber: 12.5, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["oBDBarometricPressure"], + ValueNumber: 1013.25, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["oBDEngineLoad"], + ValueNumber: 75, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["oBDIntakeTemp"], + ValueNumber: 30, + }, + { + TokenID: 123, + Timestamp: ts, + Name: vss.JSONName2CHName["oBDRunTime"], + ValueNumber: 1200, + }, + } +) diff --git a/pkg/vss/convert/payloadv2.go b/pkg/vss/convert/payloadv2.go index 50e2f6b..008bd52 100644 --- a/pkg/vss/convert/payloadv2.go +++ b/pkg/vss/convert/payloadv2.go @@ -30,10 +30,6 @@ func SignalsFromPayload(ctx context.Context, tokenGetter TokenIDGetter, jsonData } } -func isV1Payload(jsonData []byte) bool { - return gjson.GetBytes(jsonData, "specversion").String() == "1.0" -} - // SignalsFromV2Payload extracts signals from a V2 payload. func SignalsFromV2Payload(jsonData []byte) ([]vss.Signal, error) { var errs error diff --git a/pkg/vss/convert/payloadv2_test.go b/pkg/vss/convert/payloadv2_test.go index 63f01cb..cadc50e 100644 --- a/pkg/vss/convert/payloadv2_test.go +++ b/pkg/vss/convert/payloadv2_test.go @@ -13,7 +13,7 @@ const tokenID = uint32(123) func TestFullFromV2DataConversion(t *testing.T) { t.Parallel() - actualSignals, err := convert.SignalsFromPayload(nil, nil, []byte(fullV2InputJSON)) + actualSignals, err := convert.SignalsFromPayload(nil, nil, []byte(fullV2InputJSON)) //nolint:staticcheck // we want this to fail not v2 require.NoErrorf(t, err, "error converting full input data: %v", err) require.Equalf(t, expectedV2Signals, actualSignals, "converted vehicle does not match expected vehicle") } @@ -127,8 +127,9 @@ var fullV2InputJSON = `{ "model": "", "year": 0 }` + var expectedV2Signals = []vss.Signal{ - {TokenID: tokenID, Timestamp: time.Date(2024, time.April, 18, 17, 20, 26, 633000000, time.UTC), Name: "Powertrain_CombustionEngine_ECT", ValueNumber: 107, ValueString: ""}, + {TokenID: tokenID, Timestamp: time.Date(2024, time.April, 18, 17, 20, 26, 633000000, time.UTC), Name: "Powertrain_CombustionEngine_ECT", ValueNumber: 107, ValueString: ""}, //nolint // false positive {TokenID: tokenID, Timestamp: time.Date(2024, time.April, 18, 17, 20, 27, 173000000, time.UTC), Name: "Powertrain_CombustionEngine_MAF", ValueNumber: 475.79, ValueString: ""}, {TokenID: tokenID, Timestamp: time.Date(2024, time.April, 18, 17, 20, 29, 314000000, time.UTC), Name: "OBD_EngineLoad", ValueNumber: 12.54912, ValueString: ""}, {TokenID: tokenID, Timestamp: time.Date(2024, time.April, 18, 17, 20, 29, 844000000, time.UTC), Name: "Powertrain_CombustionEngine_TPS", ValueNumber: 23.529600000000002, ValueString: ""}, diff --git a/pkg/vss/signal.go b/pkg/vss/signal.go index 652a7a8..53a6b91 100644 --- a/pkg/vss/signal.go +++ b/pkg/vss/signal.go @@ -1,3 +1,4 @@ +// Package vss holds the data structures and functions for working with signals from DIMOs VSS schema. package vss import ( diff --git a/schema/embed.go b/schema/embed.go index 941d097..8001a90 100644 --- a/schema/embed.go +++ b/schema/embed.go @@ -4,8 +4,12 @@ import ( _ "embed" ) +// VssRel42DIMO is the embedded CSV file containing the VSS schema for DIMO. +// //go:embed vss_rel_4.2-DIMO.csv var VssRel42DIMO []byte +// Definitions is the embedded YAML file containing the definitions for the VSS schema. +// //go:embed definitions.yaml var Definitions []byte