Skip to content

Commit

Permalink
refactor: sort imports (#572)
Browse files Browse the repository at this point in the history
Also added gci to .golangci.yaml to keep imports consistent in the
future.
  • Loading branch information
phm07 authored Oct 19, 2023
1 parent 2473380 commit 15fa95e
Show file tree
Hide file tree
Showing 197 changed files with 441 additions and 275 deletions.
7 changes: 6 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/hetznercloud)
exhaustive:
default-signifies-exhaustive: true
gomodguard:
Expand Down Expand Up @@ -52,7 +57,7 @@ linters:
- exhaustive
# - gocritic
# - golint
# - goimports
- gci
- gomodguard
- gosec
# - gosimple
Expand Down
3 changes: 2 additions & 1 deletion internal/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package cli
import (
"time"

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/certificate"
"github.com/hetznercloud/cli/internal/cmd/completion"
"github.com/hetznercloud/cli/internal/cmd/context"
Expand All @@ -24,7 +26,6 @@ import (
"github.com/hetznercloud/cli/internal/cmd/volume"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/spf13/cobra"
)

func NewRootCommand(state *state.State, client hcapi2.Client) *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/base/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package base
import (
"context"

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/util"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/spf13/cobra"
)

// Cmd allows defining commands for generic resource-based commands
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/base/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"reflect"
"strings"

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/cmd/util"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/spf13/cobra"
)

// DeleteCmd allows defining commands for deleting a resource.
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/base/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import (
"reflect"
"strings"

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/cmd/output"
"github.com/hetznercloud/cli/internal/cmd/util"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/spf13/cobra"
)

// DescribeCmd allows defining commands for describing a resource.
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/base/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"fmt"
"strings"

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/cmd/util"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/spf13/cobra"
)

// LabelCmds allows defining commands for adding labels to resources.
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/base/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package base
import (
"context"
"fmt"

"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/hetznercloud/cli/internal/cmd/output"
"github.com/hetznercloud/cli/internal/cmd/util"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/spf13/cobra"
)

// ListCmd allows defining commands for listing resources
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/base/set_rdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import (
"reflect"
"strings"

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/cmd/util"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/spf13/cobra"
)

// SetRdnsCmd allows defining commands for setting the RDNS of a resource.
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/base/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"reflect"
"strings"

"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/cmd/util"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/spf13/cobra"
)

// UpdateCmd allows defining commands for updating a resource.
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/certificate/certificate.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package certificate

import (
"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/spf13/cobra"
)

func NewCommand(cli *state.State, client hcapi2.Client) *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/certificate/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"fmt"
"io/ioutil"

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/cmd/util"
"github.com/hetznercloud/cli/internal/state"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/spf13/cobra"
)

func newCreateCommand(cli *state.State) *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/certificate/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package certificate
import (
"context"

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/base"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/spf13/cobra"
)

var deleteCmd = base.DeleteCmd{
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/certificate/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"context"
"fmt"

"github.com/hetznercloud/cli/internal/cmd/base"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/dustin/go-humanize"
"github.com/spf13/cobra"

"github.com/dustin/go-humanize"
"github.com/hetznercloud/cli/internal/cmd/base"
"github.com/hetznercloud/cli/internal/cmd/util"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/certificate/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package certificate

import (
"context"
"github.com/spf13/pflag"
"strings"
"time"

"github.com/spf13/pflag"

"github.com/hetznercloud/cli/internal/cmd/base"
"github.com/hetznercloud/cli/internal/cmd/output"
"github.com/hetznercloud/cli/internal/cmd/util"
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/certificate/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package certificate
import (
"context"

"github.com/hetznercloud/cli/internal/cmd/base"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/hetznercloud/cli/internal/cmd/base"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/spf13/cobra"
)

var updateCmd = base.UpdateCmd{
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/cmpl/suggestions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package cmpl_test
import (
"testing"

"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"

"github.com/hetznercloud/cli/internal/cmd/cmpl"
)

func TestSuggestCandidates(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/completion/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"os"

"github.com/hetznercloud/cli/internal/state"
"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/state"
)

// const (
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/context/active.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package context
import (
"fmt"

"github.com/hetznercloud/cli/internal/state"
"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/state"
)

func newActiveCommand(cli *state.State) *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/context/context.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package context

import (
"github.com/hetznercloud/cli/internal/state"
"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/state"
)

func NewCommand(cli *state.State) *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/context/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
"strings"
"syscall"

"github.com/hetznercloud/cli/internal/state"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/terminal"

"github.com/hetznercloud/cli/internal/state"
)

func newCreateCommand(cli *state.State) *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/context/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package context
import (
"fmt"

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/state"
"github.com/spf13/cobra"
)

func newDeleteCommand(cli *state.State) *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/context/list.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package context

import (
"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/output"
"github.com/hetznercloud/cli/internal/cmd/util"
"github.com/hetznercloud/cli/internal/state"
"github.com/spf13/cobra"
)

var listTableOutput *output.Table
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/context/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package context
import (
"fmt"

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/state"
"github.com/spf13/cobra"
)

func newUseCommand(cli *state.State) *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/datacenter/datacenter.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package datacenter

import (
"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/spf13/cobra"
)

func NewCommand(cli *state.State, client hcapi2.Client) *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/datacenter/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"context"
"fmt"

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/base"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/spf13/cobra"
)

var describeCmd = base.DescribeCmd{
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/datacenter/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package datacenter

import (
"context"

"github.com/spf13/pflag"

"github.com/hetznercloud/cli/internal/cmd/base"
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/firewall/add_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"fmt"
"net"

"github.com/hetznercloud/cli/internal/cmd/base"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/base"
"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
)

var AddRuleCommand = base.Cmd{
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/firewall/apply_to_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"context"
"fmt"

"github.com/hetznercloud/cli/internal/cmd/base"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/base"
"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
)

var ApplyToResourceCommand = base.Cmd{
Expand Down
Loading

0 comments on commit 15fa95e

Please sign in to comment.