mirror of
https://github.com/valitydev/botkube.git
synced 2024-11-06 08:25:19 +00:00
Use go 1.12 for CI builds
Fix golint issues for go1.12
This commit is contained in:
parent
1f1b980f2d
commit
7139df23c3
@ -1,7 +1,7 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.11
|
||||
- 1.12
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
@ -1,15 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
set -x
|
||||
|
||||
find_files() {
|
||||
find . -not \( \
|
||||
\( \
|
||||
-wholename '*/vendor/*' \
|
||||
\) -prune \
|
||||
\) -name '*.go'
|
||||
}
|
||||
|
||||
find_files | xargs -I@ bash -c "go tool vet @"
|
||||
go vet ./pkg/...
|
||||
go vet ./cmd/...
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// K8s event types allowed to forward
|
||||
// AllowedEventType K8s event types allowed to forward
|
||||
AllowedEventType = "warning"
|
||||
|
||||
// CreateEvent when resource is created
|
||||
|
@ -119,8 +119,17 @@ func RegisterInformers(c *config.Config) {
|
||||
|
||||
log.Logger.Debugf("Received event: kind:%s ns:%s type:%s", kind, ns, eType)
|
||||
// Filter and forward
|
||||
if (utils.AllowedEventKindsMap[utils.EventKind{kind, "all"}] ||
|
||||
utils.AllowedEventKindsMap[utils.EventKind{kind, ns}]) && eType == config.AllowedEventType {
|
||||
allEvents := utils.EventKind{
|
||||
Resource: kind,
|
||||
Namespace: "all",
|
||||
}
|
||||
|
||||
nsEvent := utils.EventKind{
|
||||
Resource: kind,
|
||||
Namespace: ns,
|
||||
}
|
||||
if (utils.AllowedEventKindsMap[allEvents] ||
|
||||
utils.AllowedEventKindsMap[nsEvent]) && eType == config.AllowedEventType {
|
||||
log.Logger.Debugf("Processing add to events: %s. Invoked Object: %s:%s", key, eventObj.InvolvedObject.Kind, eventObj.InvolvedObject.Namespace)
|
||||
sendEvent(obj, c, "events", config.ErrorEvent, err)
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@ -64,7 +65,7 @@ type EventKind struct {
|
||||
func createMaps() {
|
||||
botkubeConf, err := config.New()
|
||||
if err != nil {
|
||||
log.Logger.Fatal("Error in loading configuration. Error:%s", err.Error())
|
||||
log.Logger.Fatal(fmt.Sprintf("Error in loading configuration. Error:%s", err.Error()))
|
||||
}
|
||||
|
||||
RtObjectMap = make(map[string]runtime.Object)
|
||||
|
Loading…
Reference in New Issue
Block a user