add drone ci

This commit is contained in:
Martin/Geno 2018-04-18 14:32:28 +02:00
parent 22402e3e6d
commit fbbd66e555
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A
7 changed files with 33 additions and 6 deletions

26
.drone.yml Normal file
View File

@ -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

View File

@ -1,4 +1,5 @@
# logmania # 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) [![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) [![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) [![Go Report Card](https://goreportcard.com/badge/dev.sum7.eu/genofire/logmania)](https://goreportcard.com/report/dev.sum7.eu/genofire/logmania)

View File

@ -31,7 +31,7 @@ func NewBot(db *database.DB) *Bot {
"regex-list": b.listRegex, "regex-list": b.listRegex,
"regex-del": b.delRegex, "regex-del": b.delRegex,
} }
for k, _ := range b.commandsMap { for k := range b.commandsMap {
b.commands = append(b.commands, k) b.commands = append(b.commands, k)
} }
return b return b

View File

@ -18,7 +18,7 @@ func (n *Notify) Init() {
if n.RegexIn == nil { if n.RegexIn == nil {
n.RegexIn = make(map[string]*regexp.Regexp) n.RegexIn = make(map[string]*regexp.Regexp)
} }
for exp, _ := range n.RegexIn { for exp := range n.RegexIn {
regex, err := regexp.Compile(exp) regex, err := regexp.Compile(exp)
if err == nil { if err == nil {
n.RegexIn[exp] = regex n.RegexIn[exp] = regex

View File

@ -43,7 +43,7 @@ func (db *DB) update() {
if !ok { if !ok {
notify = db.NewNotify(to) notify = db.NewNotify(to)
} }
for exp, _ := range regexs { for exp := range regexs {
notify.AddRegex(exp) notify.AddRegex(exp)
} }
} }

View File

@ -53,7 +53,7 @@ func Init(config *lib.NotifyConfig, db *database.DB, bot *bot.Bot) notify.Notifi
for { for {
element, more := client.Recv() element, more := client.Recv()
if !more { if !more {
log.Warn("could not recieve new message, try later") log.Warn("could not receive new message, try later")
continue 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 { func (n *Notifier) Send(e *log.Entry) error {
e, _, tos := n.db.SendTo(e) e, _, tos := n.db.SendTo(e)
if tos == nil || len(tos) <= 0 { if tos == nil || len(tos) <= 0 {
return errors.New("no reciever found") return errors.New("no receiver found")
} }
text, err := n.formatter.Format(e) text, err := n.formatter.Format(e)
if err != nil { if err != nil {