diff --git a/go.mod b/go.mod index c98f8aa..9bc66cf 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/cyrilix/robocar-steering-tflite-edgetpu go 1.17 require ( - github.com/cyrilix/robocar-base v0.1.4 + github.com/cyrilix/robocar-base v0.1.5 github.com/cyrilix/robocar-protobuf/go v1.0.3 github.com/eclipse/paho.mqtt.golang v1.3.5 github.com/golang/protobuf v1.5.2 diff --git a/go.sum b/go.sum index 86c5126..2620b77 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/containerd/containerd v1.4.1/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cyrilix/robocar-base v0.1.4 h1:nfnjRwAcCfS7xGu6tW9rZhmc/HZIsuDJX5NFhgX5dWE= -github.com/cyrilix/robocar-base v0.1.4/go.mod h1:Tt04UmbGBiQtU0Cn3wFD0q7XoyokTwIlWYQxThKI+04= +github.com/cyrilix/robocar-base v0.1.5 h1:EfbYHB69hgyQCVuzZ9/ifdSrQfXS7+04M8O9BDu1/5w= +github.com/cyrilix/robocar-base v0.1.5/go.mod h1:tb7R5OFoBn9EWNLX3Kzx6R/3cQ9/7r8XsHvlLSESOAM= github.com/cyrilix/robocar-protobuf/go v1.0.3 h1:iPHw2+7FVXG2C4+Th1m11hQ+2RpAQzlxKhc5M7XOa6Q= github.com/cyrilix/robocar-protobuf/go v1.0.3/go.mod h1:xb95cK07lYXnKcHZKnGafmAgYRrqZWZgV9LMiJAp+gE= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/vendor/github.com/cyrilix/robocar-base/cli/cli.go b/vendor/github.com/cyrilix/robocar-base/cli/cli.go index 7824862..08e47a6 100644 --- a/vendor/github.com/cyrilix/robocar-base/cli/cli.go +++ b/vendor/github.com/cyrilix/robocar-base/cli/cli.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/cyrilix/robocar-base/service" MQTT "github.com/eclipse/paho.mqtt.golang" - "log" + "go.uber.org/zap" "os" "os/signal" "strconv" @@ -25,7 +25,7 @@ func SetIntDefaultValueFromEnv(value *int, key string, defaultValue int) error { sVal = os.Getenv(key) val, err := strconv.Atoi(sVal) if err != nil { - log.Printf("unable to convert string to int: %v", err) + zap.S().Errorf("unable to convert string to int: %v", err) return err } *value = val @@ -40,7 +40,7 @@ func SetFloat64DefaultValueFromEnv(value *float64, key string, defaultValue floa sVal = os.Getenv(key) val, err := strconv.ParseFloat(sVal, 64) if err != nil { - log.Printf("unable to convert string to float: %v", err) + zap.S().Errorf("unable to convert string to float: %v", err) return err } *value = val @@ -81,7 +81,7 @@ func InitIntFlag(key string, defValue int) int { var value int err := SetIntDefaultValueFromEnv(&value, key, defValue) if err != nil { - log.Panicf("invalid int value: %v", err) + zap.S().Panicf("invalid int value: %v", err) } return value } @@ -90,7 +90,7 @@ func InitFloat64Flag(key string, defValue float64) float64 { var value float64 err := SetFloat64DefaultValueFromEnv(&value, key, defValue) if err != nil { - log.Panicf("invalid value: %v", err) + zap.S().Panicf("invalid value: %v", err) } return value } @@ -106,8 +106,8 @@ func Connect(uri, username, password, clientId string) (MQTT.Client, error) { opts.SetDefaultPublishHandler( //define a function for the default message handler func(client MQTT.Client, msg MQTT.Message) { - fmt.Printf("TOPIC: %s\n", msg.Topic()) - fmt.Printf("MSG: %s\n", msg.Payload()) + zap.S().Infof("TOPIC: %s", msg.Topic()) + zap.S().Infof("MSG: %s", msg.Payload()) }) //create and start a client using the above ClientOptions diff --git a/vendor/github.com/cyrilix/robocar-base/service/part.go b/vendor/github.com/cyrilix/robocar-base/service/part.go index 4a79869..3487362 100644 --- a/vendor/github.com/cyrilix/robocar-base/service/part.go +++ b/vendor/github.com/cyrilix/robocar-base/service/part.go @@ -3,21 +3,21 @@ package service import ( "fmt" mqtt "github.com/eclipse/paho.mqtt.golang" - "log" + "go.uber.org/zap" ) func StopService(name string, client mqtt.Client, topics ...string) { - log.Printf("Stop %s service", name) + zap.S().Infof("Stop %s service", name) token := client.Unsubscribe(topics...) token.Wait() if token.Error() != nil { - log.Printf("unable to unsubscribe service: %v", token.Error()) + zap.S().Errorf("unable to unsubscribe service: %v", token.Error()) } client.Disconnect(50) } func RegisterCallback(client mqtt.Client, topic string, callback mqtt.MessageHandler) error { - log.Printf("Register callback on topic %v", topic) + zap.S().Infof("Register callback on topic %v", topic) token := client.Subscribe(topic, 0, callback) token.Wait() if token.Error() != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index f95f227..a17cf36 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# github.com/cyrilix/robocar-base v0.1.4 +# github.com/cyrilix/robocar-base v0.1.5 ## explicit; go 1.17 github.com/cyrilix/robocar-base/cli github.com/cyrilix/robocar-base/service