Skip to content

Commit 1c02bbf

Browse files
authored
[cherry-pick] Use klog/v2 (#969) (#973)
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent c580d16 commit 1c02bbf

File tree

106 files changed

+21084
-5095
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+21084
-5095
lines changed

cmd/stash-mongodb/main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,22 @@ import (
2323
_ "stash.appscode.dev/apimachinery/client/clientset/versioned/fake"
2424
"stash.appscode.dev/mongodb/pkg"
2525

26-
"gomodules.xyz/kglog"
26+
"gomodules.xyz/logs"
2727
_ "k8s.io/client-go/kubernetes/fake"
2828
_ "k8s.io/client-go/plugin/pkg/client/auth"
2929
"k8s.io/klog/v2"
3030
)
3131

3232
func main() {
33-
kglog.InitLogs()
34-
defer kglog.FlushLogs()
33+
rootCmd := pkg.NewRootCmd()
34+
logs.Init(rootCmd, true)
35+
defer logs.FlushLogs()
3536

3637
if len(os.Getenv("GOMAXPROCS")) == 0 {
3738
runtime.GOMAXPROCS(runtime.NumCPU())
3839
}
3940

40-
if err := pkg.NewRootCmd().Execute(); err != nil {
41+
if err := rootCmd.Execute(); err != nil {
4142
klog.Fatalln("error:", err)
4243
}
4344
}

go.mod

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ module stash.appscode.dev/mongodb
33
go 1.15
44

55
require (
6-
github.com/codeskyblue/go-sh v0.0.0-20200712050446-30169cf553fe
6+
cloud.google.com/go v0.58.0 // indirect
77
github.com/pkg/errors v0.9.1
88
github.com/spf13/cobra v1.1.3
99
go.bytebuilders.dev/license-verifier/kubernetes v0.9.1
10-
gomodules.xyz/kglog v0.0.1
10+
gomodules.xyz/flags v0.1.0
11+
gomodules.xyz/go-sh v0.1.0
12+
gomodules.xyz/logs v0.0.2
1113
gomodules.xyz/pointer v0.0.0-20201105071923-daf60fa55209
12-
gomodules.xyz/x v0.0.4
14+
gomodules.xyz/x v0.0.5
1315
k8s.io/api v0.21.0
1416
k8s.io/apimachinery v0.21.0
1517
k8s.io/client-go v0.21.0
1618
k8s.io/klog/v2 v2.8.0
17-
kmodules.xyz/client-go v0.0.0-20210505231546-fa4fb8e1d04e
18-
kmodules.xyz/custom-resources v0.0.0-20210504034124-54c54fcdb690
19+
kmodules.xyz/client-go v0.0.0-20210605021217-cabaee7b953e
20+
kmodules.xyz/custom-resources v0.0.0-20210605111625-741fcb992541
1921
kmodules.xyz/offshoot-api v0.0.0-20210504040651-7951e351f0f5
20-
kubedb.dev/apimachinery v0.18.1-0.20210506003355-e982e5902ad2
21-
stash.appscode.dev/apimachinery v0.13.1-0.20210505235659-974fc12c7593
22+
kubedb.dev/apimachinery v0.18.1-0.20210605201001-29627ec663dc
23+
stash.appscode.dev/apimachinery v0.13.1-0.20210605201829-a382bbe2f22a
2224
)
2325

24-
replace go.mongodb.org/mongo-driver => github.com/appscode/mongo-go-driver v1.4.0-beta2.0.20210223075318-951c8933c59c
25-
2626
replace bitbucket.org/ww/goautoneg => gomodules.xyz/goautoneg v0.0.0-20120707110453-a547fc61f48d
2727

2828
replace cloud.google.com/go => cloud.google.com/go v0.54.0
@@ -127,6 +127,4 @@ replace k8s.io/kubernetes => github.com/kmodules/kubernetes v1.22.0-alpha.0.0.20
127127

128128
replace k8s.io/utils => k8s.io/utils v0.0.0-20201110183641-67b214c5f920
129129

130-
replace kmodules.xyz/resource-metadata => kmodules.xyz/resource-metadata v0.5.0
131-
132130
replace sigs.k8s.io/application => github.com/kmodules/application v0.8.4-0.20210427030912-90eeee3bc4ad

go.sum

Lines changed: 22 additions & 62 deletions
Large diffs are not rendered by default.

pkg/backup.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ import (
3636
"stash.appscode.dev/apimachinery/pkg/restic"
3737
api_util "stash.appscode.dev/apimachinery/pkg/util"
3838

39-
"github.com/codeskyblue/go-sh"
4039
"github.com/pkg/errors"
4140
"github.com/spf13/cobra"
4241
license "go.bytebuilders.dev/license-verifier/kubernetes"
42+
"gomodules.xyz/flags"
43+
"gomodules.xyz/go-sh"
4344
"gomodules.xyz/pointer"
44-
"gomodules.xyz/x/flags"
4545
core "k8s.io/api/core/v1"
4646
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4747
"k8s.io/apimachinery/pkg/types"

pkg/restore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import (
3333
"github.com/pkg/errors"
3434
"github.com/spf13/cobra"
3535
license "go.bytebuilders.dev/license-verifier/kubernetes"
36+
"gomodules.xyz/flags"
3637
"gomodules.xyz/pointer"
37-
"gomodules.xyz/x/flags"
3838
core "k8s.io/api/core/v1"
3939
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4040
"k8s.io/apimachinery/pkg/types"

pkg/root.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,9 @@ limitations under the License.
1717
package pkg
1818

1919
import (
20-
"flag"
21-
2220
"stash.appscode.dev/apimachinery/client/clientset/versioned/scheme"
2321

2422
"github.com/spf13/cobra"
25-
"gomodules.xyz/kglog"
26-
"gomodules.xyz/x/flags"
2723
v "gomodules.xyz/x/version"
2824
clientsetscheme "k8s.io/client-go/kubernetes/scheme"
2925
"kmodules.xyz/client-go/tools/cli"
@@ -40,14 +36,11 @@ func NewRootCmd() *cobra.Command {
4036
Long: `MongoDB backup & restore plugin for Stash by AppsCode. For more information, visit here: https://appscode.com/products/stash`,
4137
DisableAutoGenTag: true,
4238
PersistentPreRunE: func(c *cobra.Command, args []string) error {
43-
flags.DumpAll(c.Flags())
4439
cli.SendAnalytics(c, v.Version.Version)
4540

4641
return scheme.AddToScheme(clientsetscheme.Scheme)
4742
},
4843
}
49-
rootCmd.PersistentFlags().AddGoFlagSet(flag.CommandLine)
50-
kglog.ParseFlags()
5144
rootCmd.PersistentFlags().StringVar(&licenseApiService, "license-apiservice", "", "Name of ApiService used to expose License endpoint")
5245
rootCmd.PersistentFlags().BoolVar(&cli.EnableAnalytics, "enable-analytics", cli.EnableAnalytics, "Send analytical events to Google Analytics")
5346

vendor/github.com/Masterminds/semver/v3/.gitignore

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Masterminds/semver/v3/.golangci.yml

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Masterminds/semver/v3/CHANGELOG.md

Lines changed: 194 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Masterminds/semver/v3/LICENSE.txt

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)