Skip to content

pkg/scaffold: fixing main printVersion #752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions pkg/scaffold/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,24 @@ import (
"sigs.k8s.io/controller-runtime/pkg/runtime/signals"
)

var log = logf.Log.WithName("cmd")

func printVersion() {
logf.Log.Info(fmt.Sprintf("Go Version: %s", runtime.Version()))
logf.Log.Info(fmt.Sprintf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH))
logf.Log.Info(fmt.Sprintf("operator-sdk Version: %v", sdkVersion.Version))
log.Info(fmt.Sprintf("Go Version: %s", runtime.Version()))
log.Info(fmt.Sprintf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH))
log.Info(fmt.Sprintf("operator-sdk Version: %v", sdkVersion.Version))
}

func main() {
printVersion()
flag.Parse()

// The logger instantiated here can be changed to any logger
// implementing the logr.Logger interface. This logger will
// be propagated through the whole operator, generating
// uniform and structured logs.
logf.SetLogger(logf.ZapLogger(false))
log := logf.Log.WithName("cmd")

printVersion()

namespace, err := k8sutil.GetWatchNamespace()
if err != nil {
Expand Down
12 changes: 7 additions & 5 deletions pkg/scaffold/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,24 @@ import (
"sigs.k8s.io/controller-runtime/pkg/runtime/signals"
)

var log = logf.Log.WithName("cmd")

func printVersion() {
logf.Log.Info(fmt.Sprintf("Go Version: %s", runtime.Version()))
logf.Log.Info(fmt.Sprintf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH))
logf.Log.Info(fmt.Sprintf("operator-sdk Version: %v", sdkVersion.Version))
log.Info(fmt.Sprintf("Go Version: %s", runtime.Version()))
log.Info(fmt.Sprintf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH))
log.Info(fmt.Sprintf("operator-sdk Version: %v", sdkVersion.Version))
}

func main() {
printVersion()
flag.Parse()

// The logger instantiated here can be changed to any logger
// implementing the logr.Logger interface. This logger will
// be propagated through the whole operator, generating
// uniform and structured logs.
logf.SetLogger(logf.ZapLogger(false))
log := logf.Log.WithName("cmd")

printVersion()

namespace, err := k8sutil.GetWatchNamespace()
if err != nil {
Expand Down