feat(Makefile): add formatting target

Signed-off-by: Adam Reese <adam@reese.io>
pull/5284/head
Adam Reese 5 years ago
parent 16b59bfe5b
commit f791421fab
No known key found for this signature in database
GPG Key ID: 06F35E60A7A18DD6

@ -6,6 +6,7 @@ BINNAME ?= helm
GOPATH = $(shell go env GOPATH) GOPATH = $(shell go env GOPATH)
DEP = $(GOPATH)/bin/dep DEP = $(GOPATH)/bin/dep
GOX = $(GOPATH)/bin/gox GOX = $(GOPATH)/bin/gox
GOIMPORTS = $(GOPATH)/bin/goimports
# go option # go option
PKG := ./... PKG := ./...
@ -81,6 +82,10 @@ verify-docs: build
coverage: coverage:
@scripts/coverage.sh @scripts/coverage.sh
.PHONY: format
format: $(GOIMPORTS)
go list -f '{{.Dir}}' ./... | xargs $(GOIMPORTS) -w -local k8s.io/helm
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# dependencies # dependencies
@ -93,6 +98,9 @@ $(DEP):
$(GOX): $(GOX):
go get -u github.com/mitchellh/gox go get -u github.com/mitchellh/gox
$(GOIMPORTS):
go get -u golang.org/x/tools/cmd/goimports
# install vendored dependencies # install vendored dependencies
vendor: Gopkg.lock vendor: Gopkg.lock
$(DEP) ensure -v --vendor-only $(DEP) ensure -v --vendor-only

@ -24,11 +24,9 @@ import (
"testing" "testing"
"time" "time"
"k8s.io/client-go/kubernetes/fake"
"k8s.io/helm/pkg/tiller/environment"
shellwords "github.com/mattn/go-shellwords" shellwords "github.com/mattn/go-shellwords"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/client-go/kubernetes/fake"
"k8s.io/helm/internal/test" "k8s.io/helm/internal/test"
"k8s.io/helm/pkg/action" "k8s.io/helm/pkg/action"
@ -38,6 +36,7 @@ import (
"k8s.io/helm/pkg/repo" "k8s.io/helm/pkg/repo"
"k8s.io/helm/pkg/storage" "k8s.io/helm/pkg/storage"
"k8s.io/helm/pkg/storage/driver" "k8s.io/helm/pkg/storage/driver"
"k8s.io/helm/pkg/tiller/environment"
) )
func testTimestamper() time.Time { return time.Unix(242085845, 0).UTC() } func testTimestamper() time.Time { return time.Unix(242085845, 0).UTC() }

@ -20,10 +20,10 @@ import (
"os" "os"
"os/exec" "os/exec"
"k8s.io/helm/pkg/plugin"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/helm/pkg/plugin"
) )
const pluginHelp = ` const pluginHelp = `

@ -19,12 +19,12 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/spf13/cobra"
"k8s.io/helm/cmd/helm/require" "k8s.io/helm/cmd/helm/require"
"k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/helm/helmpath"
"k8s.io/helm/pkg/plugin" "k8s.io/helm/pkg/plugin"
"k8s.io/helm/pkg/plugin/installer" "k8s.io/helm/pkg/plugin/installer"
"github.com/spf13/cobra"
) )
type pluginInstallOptions struct { type pluginInstallOptions struct {

@ -19,10 +19,10 @@ import (
"fmt" "fmt"
"io" "io"
"k8s.io/helm/pkg/helm/helmpath"
"github.com/gosuri/uitable" "github.com/gosuri/uitable"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/helm/pkg/helm/helmpath"
) )
type pluginListOptions struct { type pluginListOptions struct {

@ -23,10 +23,10 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/spf13/cobra"
"k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/helm/helmpath"
"k8s.io/helm/pkg/plugin" "k8s.io/helm/pkg/plugin"
"github.com/spf13/cobra"
) )
func TestManuallyProcessArgs(t *testing.T) { func TestManuallyProcessArgs(t *testing.T) {

@ -24,6 +24,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/kubernetes/fake"
"k8s.io/helm/pkg/chart" "k8s.io/helm/pkg/chart"
"k8s.io/helm/pkg/hapi/release" "k8s.io/helm/pkg/hapi/release"
"k8s.io/helm/pkg/storage" "k8s.io/helm/pkg/storage"

@ -20,6 +20,7 @@ import (
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"k8s.io/helm/pkg/hapi/release" "k8s.io/helm/pkg/hapi/release"
"k8s.io/helm/pkg/storage" "k8s.io/helm/pkg/storage"
) )

@ -21,9 +21,9 @@ import (
"strings" "strings"
"testing" "testing"
"k8s.io/helm/pkg/helm/helmpath"
"github.com/spf13/pflag" "github.com/spf13/pflag"
"k8s.io/helm/pkg/helm/helmpath"
) )
func TestEnvSettings(t *testing.T) { func TestEnvSettings(t *testing.T) {

@ -32,7 +32,7 @@ import (
appsv1beta1 "k8s.io/api/apps/v1beta1" appsv1beta1 "k8s.io/api/apps/v1beta1"
appsv1beta2 "k8s.io/api/apps/v1beta2" appsv1beta2 "k8s.io/api/apps/v1beta2"
batch "k8s.io/api/batch/v1" batch "k8s.io/api/batch/v1"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
extv1beta1 "k8s.io/api/extensions/v1beta1" extv1beta1 "k8s.io/api/extensions/v1beta1"
apiequality "k8s.io/apimachinery/pkg/api/equality" apiequality "k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/errors"

@ -24,7 +24,7 @@ import (
"strings" "strings"
"testing" "testing"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"

@ -22,7 +22,7 @@ import (
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
appsv1beta1 "k8s.io/api/apps/v1beta1" appsv1beta1 "k8s.io/api/apps/v1beta1"
appsv1beta2 "k8s.io/api/apps/v1beta2" appsv1beta2 "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1" extensions "k8s.io/api/extensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/fields"

@ -18,10 +18,9 @@ package lint
import ( import (
"strings" "strings"
"testing"
"k8s.io/helm/pkg/lint/support" "k8s.io/helm/pkg/lint/support"
"testing"
) )
var values map[string]interface{} var values map[string]interface{}

@ -22,9 +22,9 @@ import (
"path/filepath" "path/filepath"
"testing" "testing"
"k8s.io/helm/pkg/helm/helmpath"
"github.com/Masterminds/vcs" "github.com/Masterminds/vcs"
"k8s.io/helm/pkg/helm/helmpath"
) )
var _ Installer = new(VCSInstaller) var _ Installer = new(VCSInstaller)

@ -23,9 +23,9 @@ import (
"runtime" "runtime"
"strings" "strings"
helm_env "k8s.io/helm/pkg/helm/environment"
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
helm_env "k8s.io/helm/pkg/helm/environment"
) )
const pluginFileName = "plugin.yaml" const pluginFileName = "plugin.yaml"

@ -21,7 +21,6 @@ import (
"context" "context"
"fmt" "fmt"
"io" "io"
"k8s.io/helm/pkg/chart"
"net" "net"
"os" "os"
"testing" "testing"
@ -31,8 +30,9 @@ import (
"github.com/docker/distribution/configuration" "github.com/docker/distribution/configuration"
"github.com/docker/distribution/registry" "github.com/docker/distribution/registry"
_ "github.com/docker/distribution/registry/storage/driver/inmemory" _ "github.com/docker/distribution/registry/storage/driver/inmemory"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"k8s.io/helm/pkg/chart"
) )
var ( var (

@ -22,7 +22,7 @@ import (
"log" "log"
"time" "time"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/helm/pkg/hapi" "k8s.io/helm/pkg/hapi"
"k8s.io/helm/pkg/hapi/release" "k8s.io/helm/pkg/hapi/release"

@ -22,7 +22,7 @@ import (
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
"github.com/pkg/errors" "github.com/pkg/errors"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/helm/pkg/hapi/release" "k8s.io/helm/pkg/hapi/release"
"k8s.io/helm/pkg/hooks" "k8s.io/helm/pkg/hooks"

@ -21,7 +21,7 @@ import (
"testing" "testing"
"time" "time"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/helm/pkg/hapi" "k8s.io/helm/pkg/hapi"
"k8s.io/helm/pkg/hapi/release" "k8s.io/helm/pkg/hapi/release"

@ -24,6 +24,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
yaml "gopkg.in/yaml.v2" yaml "gopkg.in/yaml.v2"
"k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/hapi/release" "k8s.io/helm/pkg/hapi/release"
"k8s.io/helm/pkg/hooks" "k8s.io/helm/pkg/hooks"

@ -22,8 +22,7 @@ import (
"time" "time"
"github.com/pkg/errors" "github.com/pkg/errors"
v1 "k8s.io/api/core/v1"
"k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kblabels "k8s.io/apimachinery/pkg/labels" kblabels "k8s.io/apimachinery/pkg/labels"

@ -19,7 +19,7 @@ import (
"reflect" "reflect"
"testing" "testing"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
rspb "k8s.io/helm/pkg/hapi/release" rspb "k8s.io/helm/pkg/hapi/release"
) )

@ -20,7 +20,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1" corev1 "k8s.io/client-go/kubernetes/typed/core/v1"

@ -22,8 +22,7 @@ import (
"time" "time"
"github.com/pkg/errors" "github.com/pkg/errors"
v1 "k8s.io/api/core/v1"
"k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kblabels "k8s.io/apimachinery/pkg/labels" kblabels "k8s.io/apimachinery/pkg/labels"

@ -19,7 +19,7 @@ import (
"reflect" "reflect"
"testing" "testing"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
rspb "k8s.io/helm/pkg/hapi/release" rspb "k8s.io/helm/pkg/hapi/release"
) )

@ -26,7 +26,7 @@ import (
"io" "io"
"time" "time"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/cli-runtime/pkg/genericclioptions/resource" "k8s.io/cli-runtime/pkg/genericclioptions/resource"
"k8s.io/helm/pkg/kube" "k8s.io/helm/pkg/kube"

@ -22,7 +22,7 @@ import (
"testing" "testing"
"time" "time"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/cli-runtime/pkg/genericclioptions/resource" "k8s.io/cli-runtime/pkg/genericclioptions/resource"
"k8s.io/helm/pkg/kube" "k8s.io/helm/pkg/kube"

Loading…
Cancel
Save