Skip to content

Commit 435dfad

Browse files
authored
Move preview Options to disambiguate (#6839)
This PR moves the Options type from pkg/cli/cmd/preview/options to pkg/cli/cmd/preview to disambiguate its name. It is now referenced as preview.Options instead of options.Options. Fixes #6838
2 parents 3dca4db + 7036a5b commit 435dfad

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

pkg/cli/cmd/preview.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package cmd
1616

1717
import (
1818
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/cli/cmd/preview"
19-
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/cli/cmd/preview/options"
2019
"github.com/spf13/cobra"
2120
)
2221

@@ -28,7 +27,7 @@ const (
2827
)
2928

3029
func NewPreviewCmd() *cobra.Command {
31-
opts := options.NewOptions()
30+
opts := preview.NewOptions()
3231
cmd := &cobra.Command{
3332
Use: "preview",
3433
Short: "preview Config Connector resources",

pkg/cli/cmd/preview/execute.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"fmt"
2121
"time"
2222

23-
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/cli/cmd/preview/options"
2423
corepreview "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/cli/preview"
2524
"golang.org/x/oauth2"
2625
"golang.org/x/oauth2/google"
@@ -36,7 +35,7 @@ const (
3635
defaultTimeout = 15
3736
)
3837

39-
func Execute(ctx context.Context, opts *options.Options) error {
38+
func Execute(ctx context.Context, opts *Options) error {
4039
// Use a custom FlagSet for klog to avoid conflicts with global flag.CommandLine
4140
klogFlags := flag.NewFlagSet("klog", flag.ExitOnError)
4241
klog.InitFlags(klogFlags)
@@ -103,7 +102,7 @@ func Execute(ctx context.Context, opts *options.Options) error {
103102
return nil
104103
}
105104

106-
func getRESTConfig(ctx context.Context, opts *options.Options) (*rest.Config, error) {
105+
func getRESTConfig(ctx context.Context, opts *Options) (*rest.Config, error) {
107106
// TODO: Add rate limiting to Kube client.
108107
if opts.InCluster {
109108
return rest.InClusterConfig()
@@ -119,7 +118,7 @@ func getRESTConfig(ctx context.Context, opts *options.Options) (*rest.Config, er
119118
&clientcmd.ConfigOverrides{}).ClientConfig()
120119
}
121120

122-
func getGCPAuthorization(ctx context.Context, opts *options.Options) (oauth2.TokenSource, error) {
121+
func getGCPAuthorization(ctx context.Context, opts *Options) (oauth2.TokenSource, error) {
123122
// TODO: Add scope
124123
scopes := []string{defaultScope}
125124
ts, err := google.DefaultTokenSource(ctx, scopes...)
@@ -129,7 +128,7 @@ func getGCPAuthorization(ctx context.Context, opts *options.Options) (oauth2.Tok
129128
return ts, nil
130129
}
131130

132-
func printCapturedObjects(recorder *corepreview.Recorder, opts *options.Options) error {
131+
func printCapturedObjects(recorder *corepreview.Recorder, opts *Options) error {
133132
now := time.Now()
134133
timestamp := now.Format("20060102-150405.000")
135134
summaryFile := fmt.Sprintf("%s-%s", opts.ReportNamePrefix, timestamp)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package options
15+
package preview
1616

1717
import (
1818
"github.com/spf13/pflag"

0 commit comments

Comments
 (0)