Skip to content

Commit

Permalink
chore(ci): Fix golangci-lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
christophd committed Aug 17, 2023
1 parent c164cc8 commit b3d456e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
5 changes: 0 additions & 5 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@ package main

import (
"context"
"math/rand"
"os"
"time"

"github.com/citrusframework/yaks/pkg/cmd"

_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
)

func main() {
rand.Seed(time.Now().UTC().UnixNano())

ctx, cancel := context.WithCancel(context.Background())

// Cancel ctx as soon as main returns
Expand Down
13 changes: 0 additions & 13 deletions pkg/cmd/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"context"
"flag"
"fmt"
"math/rand"
"os"
"runtime"
"strconv"
Expand Down Expand Up @@ -78,8 +77,6 @@ func printVersion() {

// Run starts the YAKS operator.
func Run(leaderElection bool, leaderElectionID string) {
rand.Seed(time.Now().UTC().UnixNano())

flag.Parse()

// The logger instantiated here can be changed to any logger
Expand Down Expand Up @@ -154,16 +151,6 @@ func Run(leaderElection bool, leaderElectionID string) {
}
}

if ok, err := kubernetes.CheckPermission(context.TODO(), c, corev1.GroupName, "events", watchNamespace, "", "create"); err != nil || !ok {
// Do not sink Events to the server as they'll be rejected
broadcaster = event.NewSinkLessBroadcaster(broadcaster)
if err != nil {
log.Error(err, "cannot check permissions for configuring event broadcaster")
} else if !ok {
log.Info("Event broadcasting to Kubernetes is disabled because of missing permissions to create events")
}
}

if ok, err := kubernetes.CheckPermission(context.TODO(), c, coordination.GroupName, "leases", operatorNamespace, "", "create"); err != nil || !ok {
leaderElection = false
exitOnError(err, "cannot check permissions for creating Leases")
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/report/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func writeReport(report string, fileName string, outputDir string) error {
return err
}

if _, err := reportFile.Write([]byte(report)); err != nil {
if _, err := reportFile.WriteString(report); err != nil {
return err
}

Expand Down

0 comments on commit b3d456e

Please sign in to comment.