From e436775c2cd1698773b2cd38c71b08a68919c250 Mon Sep 17 00:00:00 2001 From: Cyrille Nofficial Date: Tue, 12 Oct 2021 19:31:15 +0200 Subject: [PATCH] refactor: move packages to pkg directory --- cmd/rc-pca9685/rc-pca9685.go | 8 ++++---- {actuator => pkg/actuator}/pca9685.go | 0 {actuator => pkg/actuator}/steering.go | 2 +- {actuator => pkg/actuator}/throttle.go | 2 +- {part => pkg/part}/part.go | 2 +- {util => pkg/util}/util.go | 0 {util => pkg/util}/util_test.go | 0 7 files changed, 7 insertions(+), 7 deletions(-) rename {actuator => pkg/actuator}/pca9685.go (100%) rename {actuator => pkg/actuator}/steering.go (94%) rename {actuator => pkg/actuator}/throttle.go (96%) rename {part => pkg/part}/part.go (98%) rename {util => pkg/util}/util.go (100%) rename {util => pkg/util}/util_test.go (100%) diff --git a/cmd/rc-pca9685/rc-pca9685.go b/cmd/rc-pca9685/rc-pca9685.go index 230f248..61c2f25 100644 --- a/cmd/rc-pca9685/rc-pca9685.go +++ b/cmd/rc-pca9685/rc-pca9685.go @@ -3,8 +3,8 @@ package main import ( "flag" "github.com/cyrilix/robocar-base/cli" - rc "github.com/cyrilix/robocar-pca9685/actuator" - "github.com/cyrilix/robocar-pca9685/part" + actuator2 "github.com/cyrilix/robocar-pca9685/pkg/actuator" + "github.com/cyrilix/robocar-pca9685/pkg/part" log "github.com/sirupsen/logrus" "go.uber.org/zap" "os" @@ -103,8 +103,8 @@ func main() { } defer client.Disconnect(50) - t := rc.NewThrottle(throttleChannel, throttleStoppedPWM, throttleMinPWM, throttleMaxPWM) - s := rc.NewSteering(steeringChannel, steeringLeftPWM, steeringRightPWM) + t := actuator2.NewThrottle(throttleChannel, throttleStoppedPWM, throttleMinPWM, throttleMaxPWM) + s := actuator2.NewSteering(steeringChannel, steeringLeftPWM, steeringRightPWM) p := part.NewPca9685Part(client, t, s, updatePWMFrequency, topicThrottle, topicSteering) err = p.Start() diff --git a/actuator/pca9685.go b/pkg/actuator/pca9685.go similarity index 100% rename from actuator/pca9685.go rename to pkg/actuator/pca9685.go diff --git a/actuator/steering.go b/pkg/actuator/steering.go similarity index 94% rename from actuator/steering.go rename to pkg/actuator/steering.go index bfb9ecb..de3bd7f 100644 --- a/actuator/steering.go +++ b/pkg/actuator/steering.go @@ -1,7 +1,7 @@ package actuator import ( - "github.com/cyrilix/robocar-pca9685/util" + "github.com/cyrilix/robocar-pca9685/pkg/util" "go.uber.org/zap" "periph.io/x/conn/v3/gpio" "periph.io/x/devices/v3/pca9685" diff --git a/actuator/throttle.go b/pkg/actuator/throttle.go similarity index 96% rename from actuator/throttle.go rename to pkg/actuator/throttle.go index 4ce321d..4a4e10f 100644 --- a/actuator/throttle.go +++ b/pkg/actuator/throttle.go @@ -1,7 +1,7 @@ package actuator import ( - "github.com/cyrilix/robocar-pca9685/util" + "github.com/cyrilix/robocar-pca9685/pkg/util" "go.uber.org/zap" "periph.io/x/conn/v3/gpio" "periph.io/x/devices/v3/pca9685" diff --git a/part/part.go b/pkg/part/part.go similarity index 98% rename from part/part.go rename to pkg/part/part.go index eefef83..8ed18ab 100644 --- a/part/part.go +++ b/pkg/part/part.go @@ -3,7 +3,7 @@ package part import ( "fmt" "github.com/cyrilix/robocar-base/service" - "github.com/cyrilix/robocar-pca9685/actuator" + "github.com/cyrilix/robocar-pca9685/pkg/actuator" "github.com/cyrilix/robocar-protobuf/go/events" MQTT "github.com/eclipse/paho.mqtt.golang" "github.com/golang/protobuf/proto" diff --git a/util/util.go b/pkg/util/util.go similarity index 100% rename from util/util.go rename to pkg/util/util.go diff --git a/util/util_test.go b/pkg/util/util_test.go similarity index 100% rename from util/util_test.go rename to pkg/util/util_test.go