Skip to content

Commit

Permalink
fix: correct flag value type in delete, import, and write
Browse files Browse the repository at this point in the history
Fixes #387
  • Loading branch information
ewanharris committed Sep 9, 2024
1 parent 34fa32f commit 8bf614b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cmd/store/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ var importCmd = &cobra.Command{
func init() {
importCmd.Flags().String("file", "", "File Name. The file should have the store")
importCmd.Flags().String("store-id", "", "Store ID")
importCmd.Flags().Int("max-tuples-per-write", tuple.MaxTuplesPerWrite, "Max tuples per write chunk.")
importCmd.Flags().Int("max-parallel-requests", tuple.MaxParallelRequests, "Max number of requests to issue to the server in parallel.") //nolint:lll
importCmd.Flags().Int32("max-tuples-per-write", tuple.MaxTuplesPerWrite, "Max tuples per write chunk.")
importCmd.Flags().Int32("max-parallel-requests", tuple.MaxParallelRequests, "Max number of requests to issue to the server in parallel.") //nolint:lll

if err := importCmd.MarkFlagRequired("file"); err != nil {
fmt.Printf("error setting flag as required - %v: %v\n", "cmd/models/write", err)
Expand Down
4 changes: 2 additions & 2 deletions cmd/tuple/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ var deleteCmd = &cobra.Command{
func init() {
deleteCmd.Flags().String("file", "", "Tuples file")
deleteCmd.Flags().String("model-id", "", "Model ID")
deleteCmd.Flags().Int("max-tuples-per-write", MaxTuplesPerWrite, "Max tuples per write chunk.")
deleteCmd.Flags().Int("max-parallel-requests", MaxParallelRequests, "Max number of requests to issue to the server in parallel.") //nolint:lll
deleteCmd.Flags().Int32("max-tuples-per-write", MaxTuplesPerWrite, "Max tuples per write chunk.")
deleteCmd.Flags().Int32("max-parallel-requests", MaxParallelRequests, "Max number of requests to issue to the server in parallel.") //nolint:lll
}

func ExactArgsOrFlag(n int, flag string) cobra.PositionalArgs {
Expand Down
8 changes: 4 additions & 4 deletions cmd/tuple/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ import (
)

// MaxTuplesPerWrite Limit the tuples in a single batch.
var MaxTuplesPerWrite = 1
var MaxTuplesPerWrite = int32(1)

// MaxParallelRequests Limit the parallel writes to the API.
var MaxParallelRequests = 10
var MaxParallelRequests = int32(10)

Check failure on line 38 in cmd/tuple/import.go

View workflow job for this annotation

GitHub Actions / Lints

Magic number: 10, in <argument> detected (mnd)

type failedWriteResponse struct {
TupleKey client.ClientTupleKey `json:"tuple_key"`
Expand Down Expand Up @@ -206,6 +206,6 @@ var importCmd = &cobra.Command{
func init() {
importCmd.Flags().String("model-id", "", "Model ID")
importCmd.Flags().String("file", "", "Tuples file")
importCmd.Flags().Int("max-tuples-per-write", MaxTuplesPerWrite, "Max tuples per write chunk.")
importCmd.Flags().Int("max-parallel-requests", MaxParallelRequests, "Max number of requests to issue to the server in parallel.") //nolint:lll
importCmd.Flags().Int32("max-tuples-per-write", MaxTuplesPerWrite, "Max tuples per write chunk.")
importCmd.Flags().Int32("max-parallel-requests", MaxParallelRequests, "Max number of requests to issue to the server in parallel.") //nolint:lll
}
4 changes: 2 additions & 2 deletions cmd/tuple/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,6 @@ func init() {
writeCmd.Flags().String("file", "", "Tuples file")
writeCmd.Flags().String("condition-name", "", "Condition Name")
writeCmd.Flags().String("condition-context", "", "Condition Context (as a JSON string)")
writeCmd.Flags().Int("max-tuples-per-write", MaxTuplesPerWrite, "Max tuples per write chunk.")
writeCmd.Flags().Int("max-parallel-requests", MaxParallelRequests, "Max number of requests to issue to the server in parallel.")
writeCmd.Flags().Int32("max-tuples-per-write", MaxTuplesPerWrite, "Max tuples per write chunk.")
writeCmd.Flags().Int32("max-parallel-requests", MaxParallelRequests, "Max number of requests to issue to the server in parallel.") //nolint:lll

Check failure on line 154 in cmd/tuple/write.go

View workflow job for this annotation

GitHub Actions / Lints

directive `//nolint:lll` is unused for linter "lll" (nolintlint)
}

0 comments on commit 8bf614b

Please sign in to comment.