Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nitisht committed Jun 10, 2024
1 parent 42c8796 commit f232752
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions cmd/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ var AddProfileCmd = &cobra.Command{
}
return cobra.MaximumNArgs(4)(cmd, args)
},
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
name := args[0]
url, err := url.Parse(args[1])
if err != nil {
Expand Down Expand Up @@ -127,7 +127,7 @@ var RemoveProfileCmd = &cobra.Command{
Example: " pb profile remove local_parseable",
Args: cobra.ExactArgs(1),
Short: "Delete a profile",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
name := args[0]
fileConfig, err := config.ReadConfigFromFile()
if err != nil {
Expand Down Expand Up @@ -155,7 +155,7 @@ var DefaultProfileCmd = &cobra.Command{
Args: cobra.MaximumNArgs(1),
Short: "Set default profile to use with all commands",
Example: " pb profile default local_parseable",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
var name string

fileConfig, err := config.ReadConfigFromFile()
Expand Down Expand Up @@ -200,7 +200,7 @@ var ListProfileCmd = &cobra.Command{
Use: "list profiles",
Short: "List all added profiles",
Example: " pb profile list",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
fileConfig, err := config.ReadConfigFromFile()
if err != nil {
return nil
Expand Down
6 changes: 3 additions & 3 deletions cmd/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var AddRoleCmd = &cobra.Command{
Example: " pb role add ingestors",
Short: "Add a new role",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
name := args[0]

// check if the role already exists
Expand Down Expand Up @@ -158,7 +158,7 @@ var RemoveRoleCmd = &cobra.Command{
Example: " pb role remove ingestor",
Short: "Delete a role",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
name := args[0]
client := DefaultClient()
req, err := client.NewRequest("DELETE", "role/"+name, nil)
Expand Down Expand Up @@ -192,7 +192,7 @@ var ListRoleCmd = &cobra.Command{
Use: "list",
Short: "List all roles",
Example: " pb role list",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
var roles []string
client := DefaultClient()
err := fetchRoles(&client, &roles)
Expand Down
8 changes: 4 additions & 4 deletions cmd/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ var AddStreamCmd = &cobra.Command{
Example: " pb stream add backend_logs",
Short: "Create a new stream",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
name := args[0]
client := DefaultClient()
req, err := client.NewRequest("PUT", "logstream/"+name, nil)
Expand Down Expand Up @@ -132,7 +132,7 @@ var StatStreamCmd = &cobra.Command{
Example: " pb stream info backend_logs",
Short: "Get statistics for a stream",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
name := args[0]
client := DefaultClient()

Expand Down Expand Up @@ -212,7 +212,7 @@ var RemoveStreamCmd = &cobra.Command{
Example: " pb stream remove backend_logs",
Short: "Delete a stream",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
name := args[0]
client := DefaultClient()
req, err := client.NewRequest("DELETE", "logstream/"+name, nil)
Expand Down Expand Up @@ -246,7 +246,7 @@ var ListStreamCmd = &cobra.Command{
Use: "list",
Short: "List all streams",
Example: " pb stream list",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
client := DefaultClient()
req, err := client.NewRequest("GET", "logstream", nil)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var TailCmd = &cobra.Command{
Short: "Stream live events from a log stream",
Args: cobra.ExactArgs(1),
PreRunE: PreRunDefaultProfile,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
name := args[0]
profile := DefaultProfile
return tail(profile, name)
Expand Down
8 changes: 4 additions & 4 deletions cmd/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ var RemoveUserCmd = &cobra.Command{
Example: " pb user remove bob",
Short: "Delete a user",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
name := args[0]
client := DefaultClient()
req, err := client.NewRequest("DELETE", "user/"+name, nil)
Expand Down Expand Up @@ -156,13 +156,13 @@ var SetUserRoleCmd = &cobra.Command{
Use: "set-role user-name roles",
Short: "Set roles for a user",
Example: " pb user set-role bob admin,developer",
PreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(_ *cobra.Command, args []string) error {
if len(args) < 2 {
return fmt.Errorf("requires at least 2 arguments")
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
name := args[0]

client := DefaultClient()
Expand Down Expand Up @@ -232,7 +232,7 @@ var ListUserCmd = &cobra.Command{
Use: "list",
Short: "List all users",
Example: " pb user list",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
client := DefaultClient()
users, err := fetchUsers(&client)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var cli = &cobra.Command{
Use: "pb",
Short: "\nParseable command line interface",
Long: "\npb is the command line interface for Parseable",
RunE: func(command *cobra.Command, args []string) error {
RunE: func(command *cobra.Command, _ []string) error {
if p, _ := command.Flags().GetBool(versionFlag); p {
cmd.PrintVersion(Version, Commit)
return nil
Expand Down Expand Up @@ -114,7 +114,7 @@ func main() {
cli.AddCommand(cmd.TailCmd)

// Set as command
cmd.VersionCmd.Run = func(_ *cobra.Command, args []string) {
cmd.VersionCmd.Run = func(_ *cobra.Command, _ []string) {
cmd.PrintVersion(Version, Commit)
}
cli.AddCommand(cmd.VersionCmd)
Expand Down
4 changes: 2 additions & 2 deletions pkg/iterator/iterator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ func (d *DummyQueryProvider) EndTime() time.Time {
}

func (*DummyQueryProvider) QueryRunnerFunc() func(time.Time, time.Time) ([]map[string]interface{}, error) {
return func(t1, t2 time.Time) ([]map[string]interface{}, error) {
return func(_, _ time.Time) ([]map[string]interface{}, error) {
return make([]map[string]interface{}, 0), nil
}
}

func (d *DummyQueryProvider) HasDataFunc() func(time.Time, time.Time) bool {
return func(t1, t2 time.Time) bool {
return func(t1, _ time.Time) bool {
val, isExists := d.state[t1.Format(time.RFC822Z)]
if isExists && val > 0 {
return true
Expand Down
2 changes: 1 addition & 1 deletion pkg/model/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func createIteratorFromModel(m *QueryModel) *iterator.QueryIterator[QueryData, F
}
return fetchData(client, &m.profile, m.query.Value(), t1.UTC().Format(time.RFC3339), t2.UTC().Format(time.RFC3339))
},
func(t1, t2 time.Time) bool {
func(_, _ time.Time) bool {
client := &http.Client{
Timeout: time.Second * 50,
}
Expand Down

0 comments on commit f232752

Please sign in to comment.