Skip to content

Commit

Permalink
Support Go 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmalkmus committed Mar 16, 2022
1 parent 26b91ef commit 25b1362
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 134 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

env:
GOVERSION: "1.17"
GOVERSION: "1.18"

jobs:
gen-diff:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

env:
GOVERSION: "1.17"
GOVERSION: "1.18"

jobs:
gen-diff:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- "v*"

env:
GOVERSION: "1.17"
GOVERSION: "1.18"

jobs:
release:
Expand Down
3 changes: 3 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ builds:
- netgo
- static_build
flags:
- -buildvcs=false
- -buildmode=pie
- -installsuffix=cgo
- -trimpath
Expand Down Expand Up @@ -42,6 +43,7 @@ builds:

- <<: *build_defaults
flags:
- -buildvcs=false
- -buildmode=exe
- -installsuffix=cgo
- -trimpath
Expand All @@ -57,6 +59,7 @@ builds:

- <<: *build_defaults
flags:
- -buildvcs=false
- -buildmode=exe
- -installsuffix=cgo
- -trimpath
Expand Down
10 changes: 4 additions & 6 deletions Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ Bugs, feature requests, and development-related questions should be directed to

### Prerequisites:

- Go 1.17+ Installed.

- Go 1.13+ and higher **should** be sufficient enough for installing the Axiom CLI using `go get`, run:
- Go 1.18+ Installed.

```shell
$ go get -u github.com/axiomhq/cli/cmd/axiom
```
```

- Install Using [Homebrew](https://brew.sh/)
- Install Using [Homebrew](https://brew.sh/)

```shell
$ brew tap axiomhq/tap
Expand All @@ -31,7 +29,7 @@ $ brew install axiom

[Fork](https://github.com/axiomhq/cli) then clone this repository:

```
```
$ git clone https://github.com/axiomhq/cli.git
$ cd cli
$ make install # Build and install binary into $GOPATH
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ GO_LD_FLAGS += -X github.com/axiomhq/pkg/version.buildDate=$(BUILD_DATE)
GO_LD_FLAGS += -X github.com/axiomhq/pkg/version.buildUser=$(USER)

# FLAGS
GO_FLAGS := -buildmode=pie -installsuffix=cgo -trimpath -tags='$(GO_TAGS)' -ldflags='$(GO_LD_FLAGS)'
GO_FLAGS := -buildvcs=false -buildmode=pie -installsuffix=cgo -trimpath -tags='$(GO_TAGS)' -ldflags='$(GO_LD_FLAGS)'
GO_TEST_FLAGS := -race -coverprofile=$(COVERPROFILE)
GORELEASER_FLAGS := --snapshot --rm-dist

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/axiomhq/cli

go 1.17
go 1.18

require (
github.com/AlecAivazis/survey/v2 v2.3.2
Expand Down Expand Up @@ -29,6 +29,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
golang.org/x/text v0.3.7
golang.org/x/tools v0.1.9
gotest.tools/gotestsum v1.7.0
)
Expand Down Expand Up @@ -277,7 +278,6 @@ require (
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/api v0.63.0 // indirect
Expand Down
110 changes: 0 additions & 110 deletions go.sum

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions internal/cmd/organization/organization_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"context"
"fmt"
"io"
"strings"
"time"

"github.com/MakeNowJust/heredoc"
"github.com/spf13/cobra"
"golang.org/x/text/cases"
"golang.org/x/text/language"

"github.com/axiomhq/cli/internal/cmdutil"
"github.com/axiomhq/cli/pkg/iofmt"
Expand Down Expand Up @@ -93,12 +94,13 @@ func runList(ctx context.Context, opts *listOptions) error {
}
}

caser := cases.Title(language.English)
contentRow := func(trb iofmt.TableRowBuilder, k int) {
organization := organizations[k]

trb.AddField(organization.ID, nil)
trb.AddField(organization.Name, nil)
trb.AddField(strings.Title(organization.Plan.String()), nil)
trb.AddField(caser.String(organization.Plan.String()), nil)
trb.AddField(organization.PlanCreated.Format(time.RFC1123), cs.Gray)
trb.AddField(organization.PlanExpires.Format(time.RFC1123), cs.Gray)
trb.AddField(boolToStrReverseColors(cs, organization.Trialed), nil)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func run(ctx context.Context, opts *options) error {
cs := opts.IO.ColorScheme()

var enc interface {
Encode(interface{}) error
Encode(any) error
}
if opts.IO.ColorEnabled() {
enc = jsoncolor.NewEncoder(opts.IO.Out())
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/stream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func run(ctx context.Context, opts *options) error {
}

var enc interface {
Encode(interface{}) error
Encode(any) error
}
if opts.IO.ColorEnabled() {
enc = jsoncolor.NewEncoder(opts.IO.Out())
Expand Down
2 changes: 1 addition & 1 deletion internal/cmdutil/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func NeedsCloudDeployment(f *Factory) RunFunc {

// execTemplateSilent parses and executes a template, but still returns
// ErrSilent on success.
func execTemplateSilent(io *terminal.IO, tmplStr string, data interface{}) (err error) {
func execTemplateSilent(io *terminal.IO, tmplStr string, data any) (err error) {
tmpl := template.New("util").Funcs(io.ColorScheme().TemplateFuncs())
if tmpl, err = tmpl.Parse(tmplStr); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion internal/cmdutil/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewFlagError(err error) *FlagError {

// NewFlagErrorf returns a new, formatted *FlagError from the given format and
// arguments.
func NewFlagErrorf(format string, a ...interface{}) *FlagError {
func NewFlagErrorf(format string, a ...any) *FlagError {
return NewFlagError(fmt.Errorf(format, a...))
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/iofmt/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (

// jsonEncoder is an interface implemented by most JSON encoders.
type jsonEncoder interface {
Encode(interface{}) error
Encode(any) error
}

// FormatToJSON formats the given data in JSON format.
func FormatToJSON(w io.Writer, v interface{}, colorEnabled bool) error {
func FormatToJSON(w io.Writer, v any, colorEnabled bool) error {
var encoder jsonEncoder
if colorEnabled {
encoder = jsoncolor.NewEncoder(w)
Expand Down
4 changes: 2 additions & 2 deletions pkg/surveyext/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// ValidateURL validates that the given input is a valid url.
func ValidateURL(val interface{}) error {
func ValidateURL(val any) error {
rawURL, ok := val.(string)
if !ok {
return fmt.Errorf("url cannot be of type %v", reflect.TypeOf(val).Name())
Expand All @@ -30,7 +30,7 @@ func ValidateURL(val interface{}) error {

// ValidateToken validates that the given input is a valid Axiom access token
// (personal or ingest).
func ValidateToken(val interface{}) error {
func ValidateToken(val any) error {
if token, ok := val.(string); !ok {
return fmt.Errorf("token cannot be of type %v", reflect.TypeOf(val).Name())
} else if !axiom.IsPersonalToken(token) && !axiom.IsAPIToken(token) {
Expand Down
1 change: 0 additions & 1 deletion pkg/terminal/epipe_other.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build !windows
// +build !windows

package terminal

Expand Down
2 changes: 1 addition & 1 deletion tools/gen-cli-docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func disableAutoGenTag(cmd *cobra.Command) {
}
}

func fatal(msg interface{}) {
func fatal(msg any) {
fmt.Fprintln(os.Stderr, msg)
os.Exit(1)
}

0 comments on commit 25b1362

Please sign in to comment.