From fbbd66e5552156f17958c7cde9da74ab64be17f0 Mon Sep 17 00:00:00 2001 From: Martin/Geno Date: Wed, 18 Apr 2018 14:32:28 +0200 Subject: [PATCH] add drone ci --- .drone.yml | 26 ++++++++++++++++++++++++++ README.md | 1 + bot/main.go | 2 +- cmd/server.go | 2 +- database/notify.go | 2 +- database/update.go | 2 +- notify/xmpp/main.go | 4 ++-- 7 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..64e2a92 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,26 @@ +workspace: + base: /go + path: src/dev.sum7.eu/genofire/logmania + +pipeline: + build: + image: golang:latest + commands: + - go get ./... + - go build + codestyle: + image: golang:latest + commands: + - go get github.com/client9/misspell/cmd/misspell + - misspell -error . + - if [ -n "$(gofmt -s -l .)" ]; then echo "Go code is not formatted, run 'gofmt -s -w .'" >&2; exit 1; fi + test: + image: golang:latest + commands: + - go get github.com/stretchr/testify/assert + - go test ./... -v -cover + test-race: + image: golang:latest + commands: + - go get github.com/stretchr/testify/assert + - go test ./... -v -race diff --git a/README.md b/README.md index aea8871..9464a9f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # logmania +[![DroneCI](https://ci.sum7.eu/api/badges/genofire/logmania/status.svg?branch=master)](https://ci.sum7.eu/genofire/logmania) [![CircleCI](https://circleci.com/gh/genofire/logmania/tree/master.svg?style=shield)](https://circleci.com/gh/genofire/logmania/tree/master) [![Coverage Status](https://coveralls.io/repos/github/genofire/logmania/badge.svg?branch=master)](https://coveralls.io/github/genofire/logmania?branch=master) [![Go Report Card](https://goreportcard.com/badge/dev.sum7.eu/genofire/logmania)](https://goreportcard.com/report/dev.sum7.eu/genofire/logmania) diff --git a/bot/main.go b/bot/main.go index 36532f9..bdf22ff 100644 --- a/bot/main.go +++ b/bot/main.go @@ -31,7 +31,7 @@ func NewBot(db *database.DB) *Bot { "regex-list": b.listRegex, "regex-del": b.delRegex, } - for k, _ := range b.commandsMap { + for k := range b.commandsMap { b.commands = append(b.commands, k) } return b diff --git a/cmd/server.go b/cmd/server.go index 5469d5b..56b900a 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -48,7 +48,7 @@ var serverCmd = &cobra.Command{ } db = database.ReadDBFile(config.DB) - go func(){ dbSaveWorker = file.NewSaveJSONWorker(time.Minute, config.DB, db) }() + go func() { dbSaveWorker = file.NewSaveJSONWorker(time.Minute, config.DB, db) }() logmaniaBot = bot.NewBot(db) diff --git a/database/notify.go b/database/notify.go index b8b4846..ebe9624 100644 --- a/database/notify.go +++ b/database/notify.go @@ -18,7 +18,7 @@ func (n *Notify) Init() { if n.RegexIn == nil { n.RegexIn = make(map[string]*regexp.Regexp) } - for exp, _ := range n.RegexIn { + for exp := range n.RegexIn { regex, err := regexp.Compile(exp) if err == nil { n.RegexIn[exp] = regex diff --git a/database/update.go b/database/update.go index 3038bb1..7dee112 100644 --- a/database/update.go +++ b/database/update.go @@ -43,7 +43,7 @@ func (db *DB) update() { if !ok { notify = db.NewNotify(to) } - for exp, _ := range regexs { + for exp := range regexs { notify.AddRegex(exp) } } diff --git a/notify/xmpp/main.go b/notify/xmpp/main.go index bf275a5..fe3b7f4 100644 --- a/notify/xmpp/main.go +++ b/notify/xmpp/main.go @@ -53,7 +53,7 @@ func Init(config *lib.NotifyConfig, db *database.DB, bot *bot.Bot) notify.Notifi for { element, more := client.Recv() if !more { - log.Warn("could not recieve new message, try later") + log.Warn("could not receive new message, try later") continue } @@ -143,7 +143,7 @@ func Init(config *lib.NotifyConfig, db *database.DB, bot *bot.Bot) notify.Notifi func (n *Notifier) Send(e *log.Entry) error { e, _, tos := n.db.SendTo(e) if tos == nil || len(tos) <= 0 { - return errors.New("no reciever found") + return errors.New("no receiver found") } text, err := n.formatter.Format(e) if err != nil {