mirror of
https://github.com/helm/helm.git
synced 2026-02-20 00:13:02 -05:00
fix: fix a number of style errors (#5136)
This fixes a dozen or so style errors, almost all of which were just missing comments. I left several which are fixed in other outstanding PRs, or which belong to code that is about to be removed. Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
This commit is contained in:
parent
425f7a6f6c
commit
f3bfae5ea7
12 changed files with 22 additions and 4 deletions
|
|
@ -28,16 +28,19 @@ import (
|
|||
// UpdateGolden writes out the golden files with the latest values, rather than failing the test.
|
||||
var updateGolden = flag.Bool("update", false, "update golden files")
|
||||
|
||||
// TestingT describes a testing object compatible with the critical functions from the testing.T type
|
||||
type TestingT interface {
|
||||
Fatal(...interface{})
|
||||
Fatalf(string, ...interface{})
|
||||
HelperT
|
||||
}
|
||||
|
||||
// HelperT describes a test with a helper function
|
||||
type HelperT interface {
|
||||
Helper()
|
||||
}
|
||||
|
||||
// AssertGoldenBytes asserts that the give actual content matches the contents of the given filename
|
||||
func AssertGoldenBytes(t TestingT, actual []byte, filename string) {
|
||||
t.Helper()
|
||||
|
||||
|
|
@ -46,6 +49,7 @@ func AssertGoldenBytes(t TestingT, actual []byte, filename string) {
|
|||
}
|
||||
}
|
||||
|
||||
// AssertGoldenString asserts that the given string matches the contents of the given file.
|
||||
func AssertGoldenString(t TestingT, actual, filename string) {
|
||||
t.Helper()
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ func (ch *Chart) IsRoot() bool { return ch.parent == nil }
|
|||
// Parent returns a subchart's parent chart.
|
||||
func (ch *Chart) Parent() *Chart { return ch.parent }
|
||||
|
||||
// Parent sets a subchart's parent chart.
|
||||
// SetParent sets a subchart's parent chart.
|
||||
func (ch *Chart) SetParent(chart *Chart) { ch.parent = chart }
|
||||
|
||||
// ChartPath returns the full path to this chart in dot notation.
|
||||
|
|
|
|||
|
|
@ -29,8 +29,10 @@ import (
|
|||
"k8s.io/helm/pkg/chart"
|
||||
)
|
||||
|
||||
// FileLoader loads a chart from a file
|
||||
type FileLoader string
|
||||
|
||||
// Load loads a chart
|
||||
func (l FileLoader) Load() (*chart.Chart, error) {
|
||||
return LoadFile(string(l))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,10 @@ import (
|
|||
"k8s.io/helm/pkg/sympath"
|
||||
)
|
||||
|
||||
// DirLoader loads a chart from a directory
|
||||
type DirLoader string
|
||||
|
||||
// Load loads the chart
|
||||
func (l DirLoader) Load() (*chart.Chart, error) {
|
||||
return LoadDir(string(l))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import (
|
|||
"k8s.io/helm/pkg/chart"
|
||||
)
|
||||
|
||||
// ChartLoader loads a chart.
|
||||
type ChartLoader interface {
|
||||
Load() (*chart.Chart, error)
|
||||
}
|
||||
|
||||
// Loader returns a new ChartLoader appropriate for the given chart name
|
||||
func Loader(name string) (ChartLoader, error) {
|
||||
fi, err := os.Stat(name)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import (
|
|||
"k8s.io/helm/pkg/version"
|
||||
)
|
||||
|
||||
// ProcessDependencies checks through this chart's dependencies, processing accordingly.
|
||||
func ProcessDependencies(c *chart.Chart, v Values) error {
|
||||
if err := processDependencyEnabled(c, v); err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ func coalesceValues(c *chart.Chart, v map[string]interface{}) {
|
|||
}
|
||||
}
|
||||
|
||||
// coalesceTables merges a source map into a destination map.
|
||||
// CoalesceTables merges a source map into a destination map.
|
||||
//
|
||||
// dest is considered authoritative.
|
||||
func CoalesceTables(dst, src map[string]interface{}) map[string]interface{} {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,10 @@ limitations under the License.
|
|||
|
||||
package release
|
||||
|
||||
// ReleaseStatus is the status of a release
|
||||
type ReleaseStatus string
|
||||
|
||||
// Describe the status of a release
|
||||
const (
|
||||
// StatusUnknown indicates that a release is in an uncertain state.
|
||||
StatusUnknown ReleaseStatus = "unknown"
|
||||
|
|
|
|||
|
|
@ -17,8 +17,10 @@ package release
|
|||
|
||||
import "time"
|
||||
|
||||
// TestRunStatus is the status of a test run
|
||||
type TestRunStatus string
|
||||
|
||||
// Indicates the results of a test run
|
||||
const (
|
||||
TestRunUnknown TestRunStatus = "unknown"
|
||||
TestRunSuccess TestRunStatus = "success"
|
||||
|
|
@ -26,8 +28,10 @@ const (
|
|||
TestRunRunning TestRunStatus = "running"
|
||||
)
|
||||
|
||||
// Strng converts a test run status to a printable string
|
||||
func (x TestRunStatus) String() string { return string(x) }
|
||||
|
||||
// TestRun describes the run of a test
|
||||
type TestRun struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Status TestRunStatus `json:"status,omitempty"`
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release {
|
|||
name = "testrelease-" + string(rand.Intn(100))
|
||||
}
|
||||
|
||||
var version int = 1
|
||||
version := 1
|
||||
if opts.Version != 0 {
|
||||
version = opts.Version
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ func New(getter genericclioptions.RESTClientGetter) *Client {
|
|||
}
|
||||
}
|
||||
|
||||
// KubernetesClientSet returns a client set from the client factory.
|
||||
func (c *Client) KubernetesClientSet() (*kubernetes.Clientset, error) {
|
||||
return c.Factory.KubernetesClientSet()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ func (c *Client) servicesReady(svc []v1.Service) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// this function aims to check if the service's ClusterIP is set or not
|
||||
// IsServiceIPSet aims to check if the service's ClusterIP is set or not
|
||||
// the objective is not to perform validation here
|
||||
func IsServiceIPSet(service *v1.Service) bool {
|
||||
return service.Spec.ClusterIP != v1.ClusterIPNone && service.Spec.ClusterIP != ""
|
||||
|
|
|
|||
Loading…
Reference in a new issue