diff --git a/cmd/kn/main.go b/cmd/kn/main.go index 064570b25..dc3d67809 100644 --- a/cmd/kn/main.go +++ b/cmd/kn/main.go @@ -24,8 +24,6 @@ import ( "time" "github.com/spf13/cobra" - "k8s.io/client-go/rest" - "knative.dev/client/pkg/kn/config" "knative.dev/client/pkg/kn/plugin" "knative.dev/client/pkg/kn/root" @@ -36,14 +34,6 @@ func init() { } func main() { - // Override client-go's warning handler to give us nicely printed warnings. - rest.SetDefaultWarningHandler( - rest.NewWarningWriter(os.Stderr, rest.WarningWriterOptions{ - // only print a given warning the first time we receive it - Deduplicate: true, - }), - ) - os.Exit(runWithExit(os.Args[1:])) } diff --git a/pkg/kn/commands/types.go b/pkg/kn/commands/types.go index 2cb943cad..733371078 100644 --- a/pkg/kn/commands/types.go +++ b/pkg/kn/commands/types.go @@ -192,10 +192,13 @@ func (params *KnParams) RestConfig() (*rest.Config, error) { return nil, knerrors.GetError(err) } if params.LogHTTP { - // TODO: When we update to the newer version of client-go, replace with - // config.Wrap() for future compat. - config.WrapTransport = util.NewLoggingTransport + config.Wrap(util.NewLoggingTransport) } + // Override client-go's warning handler to give us nicely printed warnings. + config.WarningHandler = rest.NewWarningWriter(os.Stderr, rest.WarningWriterOptions{ + // only print a given warning the first time we receive it + Deduplicate: true, + }) return config, nil }