From d6ee08c1d24c5777d5672d4eed13b742f67eccf8 Mon Sep 17 00:00:00 2001 From: Malte Muench Date: Sun, 28 Jul 2024 23:53:17 +0200 Subject: [PATCH] Renamings, shorter, hopefully better understandable --- src/{canbus.go => can.go} | 0 .../bytecolor2colorcode.go | 2 +- .../int2ascii.go | 2 +- .../mymode.go | 2 +- src/{convertfunctions => convertmode}/none.go | 2 +- .../none_test.go | 4 ++-- .../pixelbin2ascii.go | 2 +- .../sixteenbool2ascii.go | 2 +- .../uint2ascii.go | 2 +- src/main.go | 18 +++++++++--------- src/{receiving.go => receive.go} | 0 11 files changed, 18 insertions(+), 18 deletions(-) rename src/{canbus.go => can.go} (100%) rename src/{convertfunctions => convertmode}/bytecolor2colorcode.go (97%) rename src/{convertfunctions => convertmode}/int2ascii.go (99%) rename src/{convertfunctions => convertmode}/mymode.go (98%) rename src/{convertfunctions => convertmode}/none.go (96%) rename src/{convertfunctions => convertmode}/none_test.go (99%) rename src/{convertfunctions => convertmode}/pixelbin2ascii.go (98%) rename src/{convertfunctions => convertmode}/sixteenbool2ascii.go (97%) rename src/{convertfunctions => convertmode}/uint2ascii.go (99%) rename src/{receiving.go => receive.go} (100%) diff --git a/src/canbus.go b/src/can.go similarity index 100% rename from src/canbus.go rename to src/can.go diff --git a/src/convertfunctions/bytecolor2colorcode.go b/src/convertmode/bytecolor2colorcode.go similarity index 97% rename from src/convertfunctions/bytecolor2colorcode.go rename to src/convertmode/bytecolor2colorcode.go index c402ef2..f2b44d9 100644 --- a/src/convertfunctions/bytecolor2colorcode.go +++ b/src/convertmode/bytecolor2colorcode.go @@ -1,4 +1,4 @@ -package convertfunctions +package convertmode import ( "encoding/hex" diff --git a/src/convertfunctions/int2ascii.go b/src/convertmode/int2ascii.go similarity index 99% rename from src/convertfunctions/int2ascii.go rename to src/convertmode/int2ascii.go index 3e8e11b..8f2d409 100644 --- a/src/convertfunctions/int2ascii.go +++ b/src/convertmode/int2ascii.go @@ -1,4 +1,4 @@ -package convertfunctions +package convertmode import ( "encoding/binary" diff --git a/src/convertfunctions/mymode.go b/src/convertmode/mymode.go similarity index 98% rename from src/convertfunctions/mymode.go rename to src/convertmode/mymode.go index 8123651..4ead25c 100644 --- a/src/convertfunctions/mymode.go +++ b/src/convertmode/mymode.go @@ -1,4 +1,4 @@ -package convertfunctions +package convertmode import ( "errors" diff --git a/src/convertfunctions/none.go b/src/convertmode/none.go similarity index 96% rename from src/convertfunctions/none.go rename to src/convertmode/none.go index 60fef6b..a5ca032 100644 --- a/src/convertfunctions/none.go +++ b/src/convertmode/none.go @@ -1,4 +1,4 @@ -package convertfunctions +package convertmode import "github.com/brutella/can" diff --git a/src/convertfunctions/none_test.go b/src/convertmode/none_test.go similarity index 99% rename from src/convertfunctions/none_test.go rename to src/convertmode/none_test.go index 5e8a215..c6d91a3 100644 --- a/src/convertfunctions/none_test.go +++ b/src/convertmode/none_test.go @@ -1,4 +1,4 @@ -package convertfunctions +package convertmode import ( "github.com/brutella/can" @@ -195,4 +195,4 @@ func FuzzNoneToMqtt(f *testing.F) { } }) -} +} \ No newline at end of file diff --git a/src/convertfunctions/pixelbin2ascii.go b/src/convertmode/pixelbin2ascii.go similarity index 98% rename from src/convertfunctions/pixelbin2ascii.go rename to src/convertmode/pixelbin2ascii.go index f3e4d42..0190fb3 100644 --- a/src/convertfunctions/pixelbin2ascii.go +++ b/src/convertmode/pixelbin2ascii.go @@ -1,4 +1,4 @@ -package convertfunctions +package convertmode import ( "encoding/hex" diff --git a/src/convertfunctions/sixteenbool2ascii.go b/src/convertmode/sixteenbool2ascii.go similarity index 97% rename from src/convertfunctions/sixteenbool2ascii.go rename to src/convertmode/sixteenbool2ascii.go index 03117d2..8322f80 100644 --- a/src/convertfunctions/sixteenbool2ascii.go +++ b/src/convertmode/sixteenbool2ascii.go @@ -1,4 +1,4 @@ -package convertfunctions +package convertmode import ( "errors" diff --git a/src/convertfunctions/uint2ascii.go b/src/convertmode/uint2ascii.go similarity index 99% rename from src/convertfunctions/uint2ascii.go rename to src/convertmode/uint2ascii.go index eabdaf4..80ff872 100644 --- a/src/convertfunctions/uint2ascii.go +++ b/src/convertmode/uint2ascii.go @@ -1,4 +1,4 @@ -package convertfunctions +package convertmode import ( "encoding/binary" diff --git a/src/main.go b/src/main.go index 5f2d40c..b55f12c 100644 --- a/src/main.go +++ b/src/main.go @@ -4,7 +4,7 @@ import ( "bufio" // Reader "encoding/csv" // CSV Management "flag" - "github.com/c3re/can2mqtt/convertfunctions" + "github.com/c3re/can2mqtt/convertmode" "io" // EOF const "log" // error management "log/slog" @@ -67,20 +67,20 @@ func readC2MPFromFile(filename string) { convertModeFromString = make(map[string]ConvertMode) // initialize all convertModes - convertModeFromString["none"] = convertfunctions.None{} - convertModeFromString["16bool2ascii"] = convertfunctions.SixteenBool2Ascii{} - convertModeFromString["pixelbin2ascii"] = convertfunctions.PixelBin2Ascii{} - convertModeFromString["bytecolor2colorcode"] = convertfunctions.ByteColor2ColorCode{} - convertModeFromString["mymode"] = convertfunctions.MyMode{} - // Dynamically create int and uint convertmodes + convertModeFromString["none"] = convertmode.None{} + convertModeFromString["16bool2ascii"] = convertmode.SixteenBool2Ascii{} + convertModeFromString["pixelbin2ascii"] = convertmode.PixelBin2Ascii{} + convertModeFromString["bytecolor2colorcode"] = convertmode.ByteColor2ColorCode{} + convertModeFromString["mymode"] = convertmode.MyMode{} + // Dynamically create int and uint convertmode for _, bits := range []uint{8, 16, 32, 64} { for _, instances := range []uint{1, 2, 4, 8} { if bits*instances <= 64 { // int - cmi, _ := convertfunctions.NewInt2Ascii(instances, bits) + cmi, _ := convertmode.NewInt2Ascii(instances, bits) convertModeFromString[cmi.String()] = cmi // uint - cmu, _ := convertfunctions.NewUint2Ascii(instances, bits) + cmu, _ := convertmode.NewUint2Ascii(instances, bits) convertModeFromString[cmu.String()] = cmu } } diff --git a/src/receiving.go b/src/receive.go similarity index 100% rename from src/receiving.go rename to src/receive.go