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 language: go
go: go:
- 1.11 - 1.12
services: services:
- docker - docker

View File

@ -1,15 +1,6 @@
#!/bin/bash #!/bin/bash
set -o errexit set -x
set -o nounset
set -o pipefail
find_files() { go vet ./pkg/...
find . -not \( \ go vet ./cmd/...
\( \
-wholename '*/vendor/*' \
\) -prune \
\) -name '*.go'
}
find_files | xargs -I@ bash -c "go tool vet @"

View File

@ -9,7 +9,7 @@ import (
) )
const ( const (
// K8s event types allowed to forward // AllowedEventType K8s event types allowed to forward
AllowedEventType = "warning" AllowedEventType = "warning"
// CreateEvent when resource is created // 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) log.Logger.Debugf("Received event: kind:%s ns:%s type:%s", kind, ns, eType)
// Filter and forward // Filter and forward
if (utils.AllowedEventKindsMap[utils.EventKind{kind, "all"}] || allEvents := utils.EventKind{
utils.AllowedEventKindsMap[utils.EventKind{kind, ns}]) && eType == config.AllowedEventType { 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) 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) sendEvent(obj, c, "events", config.ErrorEvent, err)
} }

View File

@ -1,6 +1,7 @@
package utils package utils
import ( import (
"fmt"
"os" "os"
"strings" "strings"
@ -64,7 +65,7 @@ type EventKind struct {
func createMaps() { func createMaps() {
botkubeConf, err := config.New() botkubeConf, err := config.New()
if err != nil { 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) RtObjectMap = make(map[string]runtime.Object)