Skip to content

Commit

Permalink
Cleanup Go modules and code
Browse files Browse the repository at this point in the history
Recreate Go modules imports to have less replace requirements.

Unify imports by running import cleanup helper.

Simplify code by removing unceccessary details.
  • Loading branch information
HeavyWombat committed Mar 5, 2021
1 parent a9657cc commit 010e592
Show file tree
Hide file tree
Showing 12 changed files with 133 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.idea
dist
**/*.coverprofile

19 changes: 5 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,18 @@ require (
github.com/gonvenience/text v1.0.6
github.com/gonvenience/wrap v1.1.0
github.com/lucasb-eyer/go-colorful v1.2.0
github.com/mitchellh/go-homedir v1.1.0
github.com/onsi/ginkgo v1.15.0
github.com/onsi/gomega v1.10.5
github.com/pelletier/go-toml v1.6.0 // indirect
github.com/shipwright-io/build v0.3.1-0.20210305111301-3e3bf18672a3
github.com/spf13/cobra v1.0.0
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.7.1
github.com/tektoncd/pipeline v0.20.1
gopkg.in/ini.v1 v1.52.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
k8s.io/api v0.18.12
k8s.io/apimachinery v0.19.0
k8s.io/api v0.19.8
k8s.io/apimachinery v0.19.8
k8s.io/client-go v12.0.0+incompatible
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451
k8s.io/utils v0.0.0-20200729134348-d5654de09c73
knative.dev/pkg v0.0.0-20210107022335-51c72e24c179
)

replace (
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.4.0
github.com/shipwright-io/build => github.com/shipwright-io/build v0.3.1-0.20210226181126-7b054edecf56
k8s.io/client-go => k8s.io/client-go v0.18.10
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29 // resolve `case-insensitive import collision` for gnostic/openapiv2 package
)
replace k8s.io/client-go => k8s.io/client-go v0.19.8
120 changes: 110 additions & 10 deletions go.sum

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion internal/cmd/buildrun-series.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ import (

"github.com/gonvenience/bunt"
"github.com/gonvenience/wrap"
"github.com/homeport/build-load/internal/load"
"github.com/spf13/cobra"

"github.com/homeport/build-load/internal/load"
)

var buildRunSeriesCmdSettings struct {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/buildrun-single.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import (
"io"

"github.com/gonvenience/bunt"
"github.com/homeport/build-load/internal/load"
"github.com/spf13/cobra"

"github.com/homeport/build-load/internal/load"
)

var buildRunOnceCmdSettings struct {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/buildrun-testplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"os"
"path/filepath"

"github.com/homeport/build-load/internal/load"
"github.com/spf13/cobra"

"github.com/homeport/build-load/internal/load"
)

var buildRunTestplanCmdSettings struct {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/builds.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import (

"github.com/gonvenience/bunt"
"github.com/gonvenience/wrap"
"github.com/homeport/build-load/internal/load"
"github.com/spf13/cobra"

"github.com/homeport/build-load/internal/load"
)

var buildsCmdSettings struct {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import (
"time"

"github.com/gonvenience/bunt"
"github.com/homeport/build-load/internal/load"
"github.com/spf13/cobra"

"github.com/homeport/build-load/internal/load"
)

var buildRunSettingsDescription = bunt.Sprintf(`
Expand Down
7 changes: 4 additions & 3 deletions internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ import (
"github.com/gonvenience/bunt"
"github.com/gonvenience/neat"
"github.com/gonvenience/wrap"
"github.com/homeport/build-load/internal/load"
"github.com/spf13/cobra"
"github.com/spf13/viper"

"github.com/homeport/build-load/internal/load"
)

var shipwriteBuildURL = bunt.Sprintf("CornflowerBlue{~https://github.com/shipwright-io/build~}")
Expand All @@ -42,8 +43,8 @@ var rootCmd = &cobra.Command{
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
if err := rootCmd.Execute(); err != nil {
var headline string = "Error occurred"
var code int = 1
var headline = "Error occurred"
var code = 1
var buf bytes.Buffer

switch terr := err.(type) {
Expand Down
2 changes: 1 addition & 1 deletion internal/load/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func registerSingleBuild(kubeAccess KubeAccess, namespace string, name string, b
return nil, err
}

var graceperiod int64 = int64(0)
var graceperiod = int64(0)
deleteOptions := metav1.DeleteOptions{GracePeriodSeconds: &graceperiod}

if !buildRunOptions.skipDelete {
Expand Down
2 changes: 1 addition & 1 deletion internal/load/buildrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func ExecuteSingleBuildRun(kubeAccess KubeAccess, namespace string, name string,
return nil, err
}

var graceperiod int64 = int64(0)
var graceperiod = int64(0)
deleteOptions := metav1.DeleteOptions{GracePeriodSeconds: &graceperiod}

if !buildRunOptions.skipDelete {
Expand Down
3 changes: 1 addition & 2 deletions internal/load/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (

"github.com/gonvenience/bunt"
"github.com/gonvenience/wrap"
"github.com/mitchellh/go-homedir"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
)
Expand All @@ -38,7 +37,7 @@ func lookUpKubeConfigFilePath() (string, error) {
return value, nil
}

homedir, err := homedir.Dir()
homedir, err := os.UserHomeDir()
if err != nil {
return "", err
}
Expand Down

0 comments on commit 010e592

Please sign in to comment.