From 60f5a69b910d57d455d4e9d3f353e82eea43705b Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Tue, 1 Oct 2024 20:12:32 -0400 Subject: [PATCH] Adding drone pipeline --- .drone.yml | 18 ++++++++++++++++++ cmd/publisher/main.go | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..9fd2e79 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,18 @@ +kind: pipeline +type: docker +name: default + +steps: +- name: Unit Test and lint + image: golang:1.23-bookworm + commands: + # - go build + - go mod download + - go test -race -v ./... + - go vet ./... + group: test-lint + +trigger: + event: + - pull_request + - push diff --git a/cmd/publisher/main.go b/cmd/publisher/main.go index 6453b15..51c8cba 100644 --- a/cmd/publisher/main.go +++ b/cmd/publisher/main.go @@ -22,7 +22,7 @@ func main() { fmt.Printf("Received Message: %s from topic %s\n", msg.Payload(), msg.Topic()) }) options.OnConnect = func(c mqtt.Client) { fmt.Println("Connected to Broker") } - options.OnConnectionLost = func(c mqtt.Client, err error) { fmt.Println("Connection Lost: %v", err) } + options.OnConnectionLost = func(c mqtt.Client, err error) { fmt.Printf("Connection Lost: %v", err) } client := mqtt.NewClient(options) if token := client.Connect(); token.Wait() && token.Error() != nil { panic(token.Error())