Use go 1.12 for CI builds

Fix golint issues for go1.12
This commit is contained in:
Prasad Ghangal 2019-06-01 21:00:44 +05:30
parent 1f1b980f2d
commit 7139df23c3
5 changed files with 18 additions and 17 deletions

View File

@ -1,7 +1,7 @@
language: go
go:
- 1.11
- 1.12
services:
- docker

View File

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

View File

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

View File

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

View File

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