build: upgrade base dependency
This commit is contained in:
parent
2e7f460eb1
commit
26eb5101f9
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module github.com/cyrilix/robocar-record
|
|||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
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/cyrilix/robocar-protobuf/go v1.0.3
|
||||||
github.com/eclipse/paho.mqtt.golang v1.3.5
|
github.com/eclipse/paho.mqtt.golang v1.3.5
|
||||||
github.com/golang/protobuf v1.5.2
|
github.com/golang/protobuf v1.5.2
|
||||||
|
4
go.sum
4
go.sum
@ -8,8 +8,8 @@ github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QH
|
|||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
github.com/containerd/containerd v1.4.1/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
|
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/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
|
||||||
github.com/cyrilix/robocar-base v0.1.4 h1:nfnjRwAcCfS7xGu6tW9rZhmc/HZIsuDJX5NFhgX5dWE=
|
github.com/cyrilix/robocar-base v0.1.5 h1:EfbYHB69hgyQCVuzZ9/ifdSrQfXS7+04M8O9BDu1/5w=
|
||||||
github.com/cyrilix/robocar-base v0.1.4/go.mod h1:Tt04UmbGBiQtU0Cn3wFD0q7XoyokTwIlWYQxThKI+04=
|
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 h1:iPHw2+7FVXG2C4+Th1m11hQ+2RpAQzlxKhc5M7XOa6Q=
|
||||||
github.com/cyrilix/robocar-protobuf/go v1.0.3/go.mod h1:xb95cK07lYXnKcHZKnGafmAgYRrqZWZgV9LMiJAp+gE=
|
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=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
14
vendor/github.com/cyrilix/robocar-base/cli/cli.go
generated
vendored
14
vendor/github.com/cyrilix/robocar-base/cli/cli.go
generated
vendored
@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/cyrilix/robocar-base/service"
|
"github.com/cyrilix/robocar-base/service"
|
||||||
MQTT "github.com/eclipse/paho.mqtt.golang"
|
MQTT "github.com/eclipse/paho.mqtt.golang"
|
||||||
"log"
|
"go.uber.org/zap"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -25,7 +25,7 @@ func SetIntDefaultValueFromEnv(value *int, key string, defaultValue int) error {
|
|||||||
sVal = os.Getenv(key)
|
sVal = os.Getenv(key)
|
||||||
val, err := strconv.Atoi(sVal)
|
val, err := strconv.Atoi(sVal)
|
||||||
if err != nil {
|
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
|
return err
|
||||||
}
|
}
|
||||||
*value = val
|
*value = val
|
||||||
@ -40,7 +40,7 @@ func SetFloat64DefaultValueFromEnv(value *float64, key string, defaultValue floa
|
|||||||
sVal = os.Getenv(key)
|
sVal = os.Getenv(key)
|
||||||
val, err := strconv.ParseFloat(sVal, 64)
|
val, err := strconv.ParseFloat(sVal, 64)
|
||||||
if err != nil {
|
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
|
return err
|
||||||
}
|
}
|
||||||
*value = val
|
*value = val
|
||||||
@ -81,7 +81,7 @@ func InitIntFlag(key string, defValue int) int {
|
|||||||
var value int
|
var value int
|
||||||
err := SetIntDefaultValueFromEnv(&value, key, defValue)
|
err := SetIntDefaultValueFromEnv(&value, key, defValue)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panicf("invalid int value: %v", err)
|
zap.S().Panicf("invalid int value: %v", err)
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ func InitFloat64Flag(key string, defValue float64) float64 {
|
|||||||
var value float64
|
var value float64
|
||||||
err := SetFloat64DefaultValueFromEnv(&value, key, defValue)
|
err := SetFloat64DefaultValueFromEnv(&value, key, defValue)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panicf("invalid value: %v", err)
|
zap.S().Panicf("invalid value: %v", err)
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
@ -106,8 +106,8 @@ func Connect(uri, username, password, clientId string) (MQTT.Client, error) {
|
|||||||
opts.SetDefaultPublishHandler(
|
opts.SetDefaultPublishHandler(
|
||||||
//define a function for the default message handler
|
//define a function for the default message handler
|
||||||
func(client MQTT.Client, msg MQTT.Message) {
|
func(client MQTT.Client, msg MQTT.Message) {
|
||||||
fmt.Printf("TOPIC: %s\n", msg.Topic())
|
zap.S().Infof("TOPIC: %s", msg.Topic())
|
||||||
fmt.Printf("MSG: %s\n", msg.Payload())
|
zap.S().Infof("MSG: %s", msg.Payload())
|
||||||
})
|
})
|
||||||
|
|
||||||
//create and start a client using the above ClientOptions
|
//create and start a client using the above ClientOptions
|
||||||
|
8
vendor/github.com/cyrilix/robocar-base/service/part.go
generated
vendored
8
vendor/github.com/cyrilix/robocar-base/service/part.go
generated
vendored
@ -3,21 +3,21 @@ package service
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
mqtt "github.com/eclipse/paho.mqtt.golang"
|
mqtt "github.com/eclipse/paho.mqtt.golang"
|
||||||
"log"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
func StopService(name string, client mqtt.Client, topics ...string) {
|
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 := client.Unsubscribe(topics...)
|
||||||
token.Wait()
|
token.Wait()
|
||||||
if token.Error() != nil {
|
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)
|
client.Disconnect(50)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterCallback(client mqtt.Client, topic string, callback mqtt.MessageHandler) error {
|
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 := client.Subscribe(topic, 0, callback)
|
||||||
token.Wait()
|
token.Wait()
|
||||||
if token.Error() != nil {
|
if token.Error() != nil {
|
||||||
|
6
vendor/github.com/cyrilix/robocar-base/testtools/testtools.go
generated
vendored
6
vendor/github.com/cyrilix/robocar-base/testtools/testtools.go
generated
vendored
@ -3,7 +3,7 @@ package testtools
|
|||||||
import (
|
import (
|
||||||
mqtt "github.com/eclipse/paho.mqtt.golang"
|
mqtt "github.com/eclipse/paho.mqtt.golang"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
log "github.com/sirupsen/logrus"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
type fakeMessage struct {
|
type fakeMessage struct {
|
||||||
@ -50,10 +50,10 @@ func NewFakeMessage(topic string, payload []byte) mqtt.Message {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFakeMessageFromProtobuf(topic string, msg proto.Message) mqtt.Message{
|
func NewFakeMessageFromProtobuf(topic string, msg proto.Message) mqtt.Message {
|
||||||
payload, err := proto.Marshal(msg)
|
payload, err := proto.Marshal(msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("unable to marshal protobuf message %T: %v", msg, err)
|
zap.S().Errorf("unable to marshal protobuf message %T: %v", msg, err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return NewFakeMessage(topic, payload)
|
return NewFakeMessage(topic, payload)
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -1,4 +1,4 @@
|
|||||||
# github.com/cyrilix/robocar-base v0.1.4
|
# github.com/cyrilix/robocar-base v0.1.5
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
github.com/cyrilix/robocar-base/cli
|
github.com/cyrilix/robocar-base/cli
|
||||||
github.com/cyrilix/robocar-base/service
|
github.com/cyrilix/robocar-base/service
|
||||||
|
Loading…
Reference in New Issue
Block a user