Skip to content

Commit

Permalink
update modules and lint (#40)
Browse files Browse the repository at this point in the history
also update go version to 1.22
  • Loading branch information
nitisht authored Jun 10, 2024
1 parent eb5cc9d commit cdbb624
Show file tree
Hide file tree
Showing 34 changed files with 123 additions and 112 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.22'

- name: make verification
run: make verifiers
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21
go-version: 1.22

- name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -26,9 +26,10 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v6
with:
version: latest
distribution: goreleaser # or 'goreleaser-pro'
version: "~> v2" # or 'latest', 'nightly', semver
args: release --parallelism 1 --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ linters-settings:
locale: US

gofumpt:
lang-version: "1.21"

# Choose whether or not to use the extra rules that are disabled
# by default
extra-rules: false
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: 2
env:
- GO111MODULE=on
- CGO_ENABLED=0
Expand All @@ -21,7 +22,6 @@ builds:

archives:
- format: tar.gz
rlcp: true
files:
- README.md
- LICENSE
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pb query "select * from backend" --from=1m --to=now
or specifying time range in rfc3999

```bash
pb query "select * from backend" --from=2023-01-00T01:40:00.000Z --to=2023-01-00T01:55:00.000Z
pb query "select * from backend" --from=2024-01-00T01:40:00.000Z --to=2024-01-00T01:55:00.000Z
```

You can use tools like `jq` and `grep` to further process and filter the output. Some examples:
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/checkdeps.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2023 Cloudnatively Services Pvt Ltd
# Copyright (c) 2024 Parseable, Inc
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/cross-compile.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2023 Cloudnatively Services Pvt Ltd
# Copyright (c) 2024 Parseable, Inc
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/gen-ldflags.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//go:build ignore
// +build ignore

// Copyright (c) 2023 Cloudnatively Services Pvt Ltd
// Copyright (c) 2024 Parseable, Inc
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion cmd/about.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Cloudnatively Services Pvt Ltd
// Copyright (c) 2024 Parseable, Inc
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion cmd/client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Cloudnatively Services Pvt Ltd
// Copyright (c) 2024 Parseable, Inc
//
//
// This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion cmd/pre.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Cloudnatively Services Pvt Ltd
// Copyright (c) 2024 Parseable, Inc
//
//
// This program is free software: you can redistribute it and/or modify
Expand Down
10 changes: 5 additions & 5 deletions cmd/profile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Cloudnatively Services Pvt Ltd
// Copyright (c) 2024 Parseable, Inc
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -65,7 +65,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 @@ -126,7 +126,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 @@ -154,7 +154,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 @@ -199,7 +199,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/query.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Cloudnatively Services Pvt Ltd
// Copyright (c) 2024 Parseable, Inc
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -106,8 +106,8 @@ var query = &cobra.Command{

var QueryCmd = func() *cobra.Command {
query.Flags().BoolP(interactiveFlag, interactiveFlagShort, false, "open the query result in interactive mode")
query.Flags().StringP(startFlag, startFlagShort, defaultStart, "Start time for query. Takes date as '2023-10-12T07:20:50.52Z' or string like '10m', '1hr'")
query.Flags().StringP(endFlag, endFlagShort, defaultEnd, "End time for query. Takes date as '2023-10-12T07:20:50.52Z' or 'now'")
query.Flags().StringP(startFlag, startFlagShort, defaultStart, "Start time for query. Takes date as '2024-10-12T07:20:50.52Z' or string like '10m', '1hr'")
query.Flags().StringP(endFlag, endFlagShort, defaultEnd, "End time for query. Takes date as '2024-10-12T07:20:50.52Z' or 'now'")
return query
}()

Expand Down
8 changes: 4 additions & 4 deletions cmd/role.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Cloudnatively Services Pvt Ltd
// Copyright (c) 2024 Parseable, Inc
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -66,7 +66,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 @@ -157,7 +157,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 @@ -191,7 +191,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
10 changes: 5 additions & 5 deletions cmd/stream.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Cloudnatively Services Pvt Ltd
// Copyright (c) 2024 Parseable, Inc
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
Expand Down 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/style.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Cloudnatively Services Pvt Ltd
// Copyright (c) 2024 Parseable, Inc
//
//
// This program is free software: you can redistribute it and/or modify
Expand Down
4 changes: 2 additions & 2 deletions cmd/tail.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Cloudnatively Services Pvt Ltd
// Copyright (c) 2024 Parseable, Inc
//
//
// This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -38,7 +38,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
10 changes: 5 additions & 5 deletions cmd/user.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Cloudnatively Services Pvt Ltd
// Copyright (c) 2024 Parseable, Inc
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
Expand Down 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
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Cloudnatively Services Pvt Ltd
// Copyright (c) 2024 Parseable, Inc
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
Expand Down
36 changes: 20 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
module pb

go 1.20
go 1.22

require (
github.com/apache/arrow/go/v13 v13.0.0
github.com/charmbracelet/bubbles v0.16.1
github.com/charmbracelet/bubbletea v0.24.2
github.com/charmbracelet/bubbletea v0.26.4
github.com/dustin/go-humanize v1.0.1
golang.org/x/exp v0.0.0-20230807204917-050eac23e9de
golang.org/x/term v0.13.0
google.golang.org/grpc v1.56.3
golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8
golang.org/x/term v0.21.0
google.golang.org/grpc v1.64.0
)

require (
github.com/charmbracelet/x/ansi v0.1.2 // indirect
github.com/charmbracelet/x/input v0.1.0 // indirect
github.com/charmbracelet/x/term v0.1.1 // indirect
github.com/charmbracelet/x/windows v0.1.0 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/flatbuffers v23.1.21+incompatible // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/klauspost/cpuid/v2 v2.2.3 // indirect
github.com/pierrec/lz4/v4 v4.1.17 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/tools v0.6.0 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/tools v0.22.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/protobuf v1.34.1 // indirect
)

require (
Expand All @@ -41,17 +46,16 @@ require (

require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/spf13/cobra v1.7.0
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
)
Loading

0 comments on commit cdbb624

Please sign in to comment.