Skip to content

Commit

Permalink
use Println instead of Printf when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
nopcoder committed Aug 1, 2023
1 parent 8cf40f8 commit 65e5674
Show file tree
Hide file tree
Showing 26 changed files with 32 additions and 29 deletions.
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/abuse_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var abuseCommitCmd = &cobra.Command{
amount := Must(cmd.Flags().GetInt("amount"))
gapDuration := Must(cmd.Flags().GetDuration("gap"))

fmt.Printf("Source branch: %s\n", u)
fmt.Println("Source branch:", u)

generator := stress.NewGenerator("commit", 1, stress.WithSignalHandlersFor(os.Interrupt, syscall.SIGTERM))

Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/abuse_create_branches.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var abuseCreateBranchesCmd = &cobra.Command{

client := getClient()

fmt.Printf("Source ref: %s\n", u)
fmt.Println("Source ref:", u)
deleteGen := stress.NewGenerator("delete branch", parallelism)

const paginationAmount = 1000
Expand Down
4 changes: 2 additions & 2 deletions cmd/lakectl/cmd/abuse_link_same_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ var abuseLinkSameObjectCmd = &cobra.Command{
parallelism := Must(cmd.Flags().GetInt("parallelism"))
key := Must(cmd.Flags().GetString("key"))

fmt.Printf("Source ref: %s\n", u)
fmt.Printf("Object key: %s\n", key)
fmt.Println("Source ref:", u)
fmt.Println("Object key:", key)

generator := stress.NewGenerator("get-and-link", parallelism, stress.WithSignalHandlersFor(os.Interrupt, syscall.SIGTERM))

Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/abuse_random_read.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var abuseRandomReadsCmd = &cobra.Command{
parallelism := Must(cmd.Flags().GetInt("parallelism"))
fromFile := Must(cmd.Flags().GetString("from-file"))

fmt.Printf("Source ref: %s\n", u)
fmt.Println("Source ref:", u)
// read the input file
keys, err := readLines(fromFile)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/abuse_random_writes.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var abuseRandomWritesCmd = &cobra.Command{
parallelism := Must(cmd.Flags().GetInt("parallelism"))
prefix := Must(cmd.Flags().GetString("prefix"))

fmt.Printf("Source branch: %s\n", u)
fmt.Println("Source branch:", u)
generator := stress.NewGenerator("stage object", parallelism, stress.WithSignalHandlersFor(os.Interrupt, syscall.SIGTERM))

// generate randomly selected keys as input
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/actions_runs_describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var actionsRunsDescribeCmd = &cobra.Command{
u := MustParseRepoURI("repository", args[0])
pagination := api.Pagination{HasMore: true}

fmt.Printf("Repository: %s\n", u)
fmt.Println("Repository:", u)
runID := args[1]

client := getClient()
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/branch_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var branchCreateCmd = &cobra.Command{
if err != nil {
DieFmt("failed to parse source URI: %s", err)
}
fmt.Printf("Source ref: %s\n", sourceURI)
fmt.Println("Source ref:", sourceURI)
if sourceURI.Repository != u.Repository {
Die("source branch must be in the same repository", 1)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/branch_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var branchDeleteCmd = &cobra.Command{
}
client := getClient()
u := MustParseBranchURI("branch", args[0])
fmt.Printf("Branch: %s\n", u)
fmt.Println("Branch:", u)
resp, err := client.DeleteBranchWithResponse(cmd.Context(), u.Repository, u.Ref)
DieOnErrorOrUnexpectedStatusCode(resp, err, http.StatusNoContent)
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/branch_reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var branchResetCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
clt := getClient()
u := MustParseBranchURI("branch", args[0])
fmt.Printf("Branch: %s\n", u)
fmt.Println("Branch:", u)
prefix, err := cmd.Flags().GetString("prefix")
if err != nil {
DieErr(err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/branch_revert.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var branchRevertCmd = &cobra.Command{
},
Run: func(cmd *cobra.Command, args []string) {
u := MustParseBranchURI("branch", args[0])
fmt.Printf("Branch: %s\n", u)
fmt.Println("Branch:", u)
hasParentNumber := cmd.Flags().Changed(ParentNumberFlagName)
parentNumber := Must(cmd.Flags().GetInt(ParentNumberFlagName))
if hasParentNumber && parentNumber <= 0 {
Expand Down
4 changes: 2 additions & 2 deletions cmd/lakectl/cmd/branch_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ var branchShowCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
client := getClient()
u := MustParseBranchURI("branch", args[0])
fmt.Printf("Branch: %s\n", u)
fmt.Println("Branch:", u)
resp, err := client.GetBranchWithResponse(cmd.Context(), u.Repository, u.Ref)
DieOnErrorOrUnexpectedStatusCode(resp, err, http.StatusOK)
if resp.JSON200 == nil {
Die("Bad response from server", 1)
}
branch := resp.JSON200
fmt.Printf("Commit ID: %s\n", branch.CommitId)
fmt.Println("Commit ID:", branch.CommitId)
},
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/cat_hook_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var catHookOutputCmd = &cobra.Command{
ValidArgsFunction: ValidArgsRepository,
Run: func(cmd *cobra.Command, args []string) {
u := MustParseRepoURI("repository", args[0])
fmt.Printf("Repository: %s\n", u)
fmt.Println("Repository:", u)
runID := args[1]
hookRunID := args[2]
client := getClient()
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/cherry_pick.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var cherryPick = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
ref := MustParseRefURI("ref", args[0])
branch := MustParseBranchURI("branch", args[1])
fmt.Printf("Branch: %s\n", branch)
fmt.Println("Branch:", branch)

if branch.Repository != ref.Repository {
Die("Repository mismatch for destination branch and cherry-pick ref", 1)
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var commitCmd = &cobra.Command{
}

branchURI := MustParseRefURI("branch", args[0])
fmt.Printf("Branch: %s\n", branchURI)
fmt.Println("Branch:", branchURI)

// do commit
metadata := api.CommitCreation_Metadata{
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/dbt_generate_schema_macro.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ generate_schema_name.sql
if err != nil {
DieErr(err)
}
fmt.Printf("macro created in path %s\n", macroPath)
fmt.Println("macro created in path", macroPath)
},
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var diffCmd = &cobra.Command{
if len(args) == diffCmdMinArgs {
// got one arg ref: uncommitted changes diff
branchURI := MustParseRefURI("ref", args[0])
fmt.Printf("Ref: %s\n", branchURI)
fmt.Println("Ref:", branchURI)
printDiffBranch(cmd.Context(), client, branchURI.Repository, branchURI.Ref)
return
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/lakectl/cmd/find_merge_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ var findMergeBaseCmd = &cobra.Command{
client := getClient()
sourceRef := MustParseRefURI("source ref", args[0])
destinationRef := MustParseRefURI("destination ref", args[1])
fmt.Printf("Source: %s\nDestination: %s\n", sourceRef, destinationRef)
fmt.Println("Source:", sourceRef)
fmt.Println("Destination:", destinationRef)
if destinationRef.Repository != sourceRef.Repository {
Die("both references must belong to the same repository", 1)
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/lakectl/cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ var importCmd = &cobra.Command{
for {
select {
case <-sigCtx.Done():
fmt.Printf("\nCanceling import\n")
fmt.Println()
fmt.Println("Canceling import")
resp, err := client.ImportCancelWithResponse(ctx, toURI.Repository, toURI.Ref, &api.ImportCancelParams{Id: importID})
DieOnErrorOrUnexpectedStatusCode(resp, err, http.StatusNoContent)
Die("Import Canceled", 1)
Expand Down
3 changes: 2 additions & 1 deletion cmd/lakectl/cmd/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ var mergeCmd = &cobra.Command{
sourceRef := MustParseRefURI("source ref", args[0])
destinationRef := MustParseRefURI("destination ref", args[1])
strategy := Must(cmd.Flags().GetString("strategy"))
fmt.Printf("Source: %s\nDestination: %s\n", sourceRef, destinationRef)
fmt.Println("Source:", sourceRef)
fmt.Println("Destination:", destinationRef)
if destinationRef.Repository != sourceRef.Repository {
Die("both references must belong to the same repository", 1)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/lakectl/cmd/metastore_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ var metastoreDiffCmd = &cobra.Command{
} else {
fmt.Println("Columns")
for _, column := range diff.ColumnsDiff {
fmt.Printf("%s\n", column)
fmt.Println(column)
}
}
if len(diff.PartitionDiff) == 0 {
fmt.Println("Partitions are identical")
} else {
fmt.Println("Partitions")
for _, partition := range diff.PartitionDiff {
fmt.Printf("%s\n", partition)
fmt.Println(partition)
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/refs_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Since a bare repo is expected, in case of transient failure, delete the reposito
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
repoURI := MustParseRepoURI("repository", args[0])
fmt.Printf("Repository: %s\n", repoURI)
fmt.Println("Repository:", repoURI)
manifestFileName := Must(cmd.Flags().GetString("manifest"))
fp := Must(OpenByPath(manifestFileName))
defer func() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/repo_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var repoCreateCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
clt := getClient()
u := MustParseRepoURI("repository", args[0])
fmt.Printf("Repository: %s\n", u)
fmt.Println("Repository:", u)
defaultBranch, err := cmd.Flags().GetString("default-branch")
if err != nil {
DieErr(err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/repo_create_bare.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var repoCreateBareCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
clt := getClient()
u := MustParseRepoURI("repository", args[0])
fmt.Printf("Repository: %s\n", u)
fmt.Println("Repository:", u)
defaultBranch, err := cmd.Flags().GetString("default-branch")
if err != nil {
DieErr(err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/repo_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var repoDeleteCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
clt := getClient()
u := MustParseRepoURI("repository", args[0])
fmt.Printf("Repository: %s\n", u)
fmt.Println("Repository:", u)
confirmation, err := Confirm(cmd.Flags(), "Are you sure you want to delete repository: "+u.Repository)
if err != nil || !confirmation {
DieFmt("Delete Repository '%s' aborted\n", u.Repository)
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/tag_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var tagCreateCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
tagURI := MustParseRefURI("tag uri", args[0])
commitURI := MustParseRefURI("commit uri", args[1])
fmt.Printf("Tag ref: %s\n", tagURI)
fmt.Println("Tag ref:", tagURI)

client := getClient()
ctx := cmd.Context()
Expand Down
2 changes: 1 addition & 1 deletion cmd/lakectl/cmd/tag_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var tagDeleteCmd = &cobra.Command{
}
client := getClient()
u := MustParseRefURI("tag", args[0])
fmt.Printf("Tag ref: %s\n", u)
fmt.Println("Tag ref:", u)

ctx := cmd.Context()
resp, err := client.DeleteTagWithResponse(ctx, u.Repository, u.Ref)
Expand Down

0 comments on commit 65e5674

Please sign in to comment.