Skip to content

Commit

Permalink
updated imports (and go fmt)
Browse files Browse the repository at this point in the history
  • Loading branch information
zackbradys committed Jun 14, 2024
1 parent d59b29b commit 7a7906b
Show file tree
Hide file tree
Showing 19 changed files with 45 additions and 53 deletions.
37 changes: 19 additions & 18 deletions cmd/hauler/cli/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package cli

import (
"fmt"
"github.com/spf13/cobra"
"os"

"github.com/spf13/cobra"
)

func addCompletion(parent *cobra.Command) {
Expand Down Expand Up @@ -34,19 +35,19 @@ func addCompletionZsh() *cobra.Command {
Short: "Generates zsh completion scripts",
Long: `The completion sub-command generates completion scripts for zsh.`,
Example: `To load completion run
. <(hauler completion zsh)
To configure your zsh shell to load completions for each session add to your zshrc
# ~/.zshrc or ~/.profile
command -v hauler >/dev/null && . <(hauler completion zsh)
or write a cached file in one of the completion directories in your ${fpath}:
echo "${fpath// /\n}" | grep -i completion
hauler completion zsh > _hauler
mv _hauler ~/.oh-my-zsh/completions # oh-my-zsh
mv _hauler ~/.zprezto/modules/completion/external/src/ # zprezto`,
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -64,11 +65,11 @@ func addCompletionBash() *cobra.Command {
Short: "Generates bash completion scripts",
Long: `The completion sub-command generates completion scripts for bash.`,
Example: `To load completion run
. <(hauler completion bash)
To configure your bash shell to load completions for each session add to your bashrc
# ~/.bashrc or ~/.profile
command -v hauler >/dev/null && . <(hauler completion bash)`,
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -84,9 +85,9 @@ func addCompletionFish() *cobra.Command {
Short: "Generates fish completion scripts",
Long: `The completion sub-command generates completion scripts for fish.`,
Example: `To configure your fish shell to load completions for each session write this script to your completions dir:
hauler completion fish > ~/.config/fish/completions/hauler.fish
See http://fishshell.com/docs/current/index.html#completion-own for more details`,
Run: func(cmd *cobra.Command, args []string) {
cmd.GenFishCompletion(os.Stdout, true)
Expand All @@ -101,18 +102,18 @@ func addCompletionPowershell() *cobra.Command {
Short: "Generates powershell completion scripts",
Long: `The completion sub-command generates completion scripts for powershell.`,
Example: `To load completion run
. <(hauler completion powershell)
To configure your powershell shell to load completions for each session add to your powershell profile
Windows:
cd "$env:USERPROFILE\Documents\WindowsPowerShell\Modules"
hauler completion powershell >> hauler-completion.ps1
Linux:
cd "${XDG_CONFIG_HOME:-"$HOME/.config/"}/powershell/modules"
hauler completion powershell >> hauler-completions.ps1`,
Run: func(cmd *cobra.Command, args []string) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/hauler/cli/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package cli
import (
"context"
"fmt"
"github.com/spf13/cobra"
"io"
"os"
"strings"

"github.com/spf13/cobra"
"oras.land/oras-go/pkg/content"

"github.com/rancherfederal/hauler/pkg/cosign"
Expand Down
1 change: 1 addition & 0 deletions cmd/hauler/cli/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cli

import (
"fmt"

"github.com/spf13/cobra"
"helm.sh/helm/v3/pkg/action"

Expand Down
6 changes: 2 additions & 4 deletions cmd/hauler/cli/store/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ import (
"github.com/spf13/cobra"
"helm.sh/helm/v3/pkg/action"

"github.com/rancherfederal/hauler/pkg/artifacts/file"

"github.com/rancherfederal/hauler/pkg/store"

"github.com/rancherfederal/hauler/pkg/apis/hauler.cattle.io/v1alpha1"
"github.com/rancherfederal/hauler/pkg/artifacts/file"
"github.com/rancherfederal/hauler/pkg/content/chart"
"github.com/rancherfederal/hauler/pkg/cosign"
"github.com/rancherfederal/hauler/pkg/log"
"github.com/rancherfederal/hauler/pkg/reference"
"github.com/rancherfederal/hauler/pkg/store"
)

type AddFileOpts struct {
Expand Down
3 changes: 1 addition & 2 deletions cmd/hauler/cli/store/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import (
"oras.land/oras-go/pkg/content"

"github.com/rancherfederal/hauler/pkg/cosign"
"github.com/rancherfederal/hauler/pkg/store"

"github.com/rancherfederal/hauler/pkg/log"
"github.com/rancherfederal/hauler/pkg/store"
)

type CopyOpts struct {
Expand Down
3 changes: 1 addition & 2 deletions cmd/hauler/cli/store/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import (
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/spf13/cobra"

"github.com/rancherfederal/hauler/pkg/store"

"github.com/rancherfederal/hauler/internal/mapper"
"github.com/rancherfederal/hauler/pkg/log"
"github.com/rancherfederal/hauler/pkg/reference"
"github.com/rancherfederal/hauler/pkg/store"
)

type ExtractOpts struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/hauler/cli/store/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"os"
"path/filepath"

"github.com/rancherfederal/hauler/pkg/store"
"github.com/spf13/cobra"

"github.com/rancherfederal/hauler/pkg/log"
"github.com/rancherfederal/hauler/pkg/store"
)

const (
Expand Down
6 changes: 2 additions & 4 deletions cmd/hauler/cli/store/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/olekukonko/tablewriter"
"os"
"sort"

"github.com/olekukonko/tablewriter"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/spf13/cobra"

"github.com/rancherfederal/hauler/pkg/consts"

"github.com/rancherfederal/hauler/pkg/store"

"github.com/rancherfederal/hauler/pkg/reference"
"github.com/rancherfederal/hauler/pkg/store"
)

type InfoOpts struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/hauler/cli/store/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"os"

"github.com/mholt/archiver/v3"
"github.com/rancherfederal/hauler/pkg/content"
"github.com/rancherfederal/hauler/pkg/store"
"github.com/spf13/cobra"

"github.com/rancherfederal/hauler/pkg/content"
"github.com/rancherfederal/hauler/pkg/log"
"github.com/rancherfederal/hauler/pkg/store"
)

type LoadOpts struct {
Expand Down
3 changes: 1 addition & 2 deletions cmd/hauler/cli/store/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ import (
"github.com/distribution/distribution/v3/version"
"github.com/spf13/cobra"

"github.com/rancherfederal/hauler/pkg/store"

"github.com/rancherfederal/hauler/internal/server"
"github.com/rancherfederal/hauler/pkg/log"
"github.com/rancherfederal/hauler/pkg/store"
)

type ServeRegistryOpts struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/mapper/filestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package mapper

import (
"context"
"io/ioutil"
"io"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -59,7 +59,7 @@ func (s *pusher) Push(ctx context.Context, desc ocispec.Descriptor) (ccontent.Wr

// If no custom mapper found, fall back to content.File mapper
if _, ok := s.mapper[desc.MediaType]; !ok {
return content.NewIoContentWriter(ioutil.Discard, content.WithOutputHash(desc.Digest)), nil
return content.NewIoContentWriter(io.Discard, content.WithOutputHash(desc.Digest)), nil
}

filename, err := s.mapper[desc.MediaType](desc)
Expand Down
4 changes: 3 additions & 1 deletion pkg/apis/hauler.cattle.io/v1alpha1/k3s.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package v1alpha1

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const K3sCollectionKind = "K3s"

Expand Down
4 changes: 2 additions & 2 deletions pkg/collection/chart/chart.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package chart

import (
"github.com/rancherfederal/hauler/pkg/artifacts"
"github.com/rancherfederal/hauler/pkg/artifacts/image"
"helm.sh/helm/v3/pkg/action"

"github.com/rancherfederal/hauler/pkg/apis/hauler.cattle.io/v1alpha1"
"github.com/rancherfederal/hauler/pkg/artifacts"
"github.com/rancherfederal/hauler/pkg/artifacts/image"
"github.com/rancherfederal/hauler/pkg/content/chart"
"github.com/rancherfederal/hauler/pkg/reference"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/collection/imagetxt/imagetxt.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (
"strings"
"sync"

"github.com/rancherfederal/hauler/pkg/log"

"github.com/google/go-containerregistry/pkg/name"

artifact "github.com/rancherfederal/hauler/pkg/artifacts"
"github.com/rancherfederal/hauler/pkg/artifacts/file/getter"
"github.com/rancherfederal/hauler/pkg/artifacts/image"
"github.com/rancherfederal/hauler/pkg/log"
)

type ImageTxt struct {
Expand Down
5 changes: 1 addition & 4 deletions pkg/collection/k3s/k3s.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ import (
"strings"

"github.com/rancherfederal/hauler/pkg/artifacts"
"github.com/rancherfederal/hauler/pkg/artifacts/image"

"github.com/rancherfederal/hauler/pkg/artifacts/file"

"github.com/rancherfederal/hauler/pkg/artifacts/file/getter"

"github.com/rancherfederal/hauler/pkg/artifacts/image"
"github.com/rancherfederal/hauler/pkg/reference"
)

Expand Down
3 changes: 1 addition & 2 deletions pkg/content/chart/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ import (
"helm.sh/helm/v3/pkg/cli"
"helm.sh/helm/v3/pkg/registry"

"github.com/rancherfederal/hauler/pkg/layer"

"github.com/rancherfederal/hauler/pkg/consts"
"github.com/rancherfederal/hauler/pkg/layer"
)

var (
Expand Down
1 change: 0 additions & 1 deletion pkg/content/chart/chart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"helm.sh/helm/v3/pkg/action"

"github.com/rancherfederal/hauler/pkg/consts"

"github.com/rancherfederal/hauler/pkg/content/chart"
)

Expand Down
3 changes: 1 addition & 2 deletions pkg/content/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"sort"
Expand Down Expand Up @@ -275,7 +274,7 @@ func (p *ociPusher) Push(ctx context.Context, d ocispec.Descriptor) (ccontent.Wr

if _, err := os.Stat(blobPath); err == nil {
// file already exists, discard (but validate digest)
return content.NewIoContentWriter(ioutil.Discard, content.WithOutputHash(d.Digest)), nil
return content.NewIoContentWriter(io.Discard, content.WithOutputHash(d.Digest)), nil
}

f, err := os.Create(blobPath)
Expand Down
3 changes: 2 additions & 1 deletion pkg/cosign/cosign.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
"strings"
"time"

"oras.land/oras-go/pkg/content"

"github.com/rancherfederal/hauler/pkg/artifacts/image"
"github.com/rancherfederal/hauler/pkg/log"
"github.com/rancherfederal/hauler/pkg/store"
"oras.land/oras-go/pkg/content"
)

const maxRetries = 3
Expand Down

0 comments on commit 7a7906b

Please sign in to comment.