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>
pull/5142/head
Matt Butcher 7 years ago committed by GitHub
parent 425f7a6f6c
commit f3bfae5ea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,16 +28,19 @@ import (
// UpdateGolden writes out the golden files with the latest values, rather than failing the test. // UpdateGolden writes out the golden files with the latest values, rather than failing the test.
var updateGolden = flag.Bool("update", false, "update golden files") 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 { type TestingT interface {
Fatal(...interface{}) Fatal(...interface{})
Fatalf(string, ...interface{}) Fatalf(string, ...interface{})
HelperT HelperT
} }
// HelperT describes a test with a helper function
type HelperT interface { type HelperT interface {
Helper() Helper()
} }
// AssertGoldenBytes asserts that the give actual content matches the contents of the given filename
func AssertGoldenBytes(t TestingT, actual []byte, filename string) { func AssertGoldenBytes(t TestingT, actual []byte, filename string) {
t.Helper() 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) { func AssertGoldenString(t TestingT, actual, filename string) {
t.Helper() t.Helper()

@ -78,7 +78,7 @@ func (ch *Chart) IsRoot() bool { return ch.parent == nil }
// Parent returns a subchart's parent chart. // Parent returns a subchart's parent chart.
func (ch *Chart) Parent() *Chart { return ch.parent } 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 } func (ch *Chart) SetParent(chart *Chart) { ch.parent = chart }
// ChartPath returns the full path to this chart in dot notation. // ChartPath returns the full path to this chart in dot notation.

@ -29,8 +29,10 @@ import (
"k8s.io/helm/pkg/chart" "k8s.io/helm/pkg/chart"
) )
// FileLoader loads a chart from a file
type FileLoader string type FileLoader string
// Load loads a chart
func (l FileLoader) Load() (*chart.Chart, error) { func (l FileLoader) Load() (*chart.Chart, error) {
return LoadFile(string(l)) return LoadFile(string(l))
} }

@ -29,8 +29,10 @@ import (
"k8s.io/helm/pkg/sympath" "k8s.io/helm/pkg/sympath"
) )
// DirLoader loads a chart from a directory
type DirLoader string type DirLoader string
// Load loads the chart
func (l DirLoader) Load() (*chart.Chart, error) { func (l DirLoader) Load() (*chart.Chart, error) {
return LoadDir(string(l)) return LoadDir(string(l))
} }

@ -28,10 +28,12 @@ import (
"k8s.io/helm/pkg/chart" "k8s.io/helm/pkg/chart"
) )
// ChartLoader loads a chart.
type ChartLoader interface { type ChartLoader interface {
Load() (*chart.Chart, error) Load() (*chart.Chart, error)
} }
// Loader returns a new ChartLoader appropriate for the given chart name
func Loader(name string) (ChartLoader, error) { func Loader(name string) (ChartLoader, error) {
fi, err := os.Stat(name) fi, err := os.Stat(name)
if err != nil { if err != nil {

@ -23,6 +23,7 @@ import (
"k8s.io/helm/pkg/version" "k8s.io/helm/pkg/version"
) )
// ProcessDependencies checks through this chart's dependencies, processing accordingly.
func ProcessDependencies(c *chart.Chart, v Values) error { func ProcessDependencies(c *chart.Chart, v Values) error {
if err := processDependencyEnabled(c, v); err != nil { if err := processDependencyEnabled(c, v); err != nil {
return err 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. // dest is considered authoritative.
func CoalesceTables(dst, src map[string]interface{}) map[string]interface{} { func CoalesceTables(dst, src map[string]interface{}) map[string]interface{} {

@ -15,8 +15,10 @@ limitations under the License.
package release package release
// ReleaseStatus is the status of a release
type ReleaseStatus string type ReleaseStatus string
// Describe the status of a release
const ( const (
// StatusUnknown indicates that a release is in an uncertain state. // StatusUnknown indicates that a release is in an uncertain state.
StatusUnknown ReleaseStatus = "unknown" StatusUnknown ReleaseStatus = "unknown"

@ -17,8 +17,10 @@ package release
import "time" import "time"
// TestRunStatus is the status of a test run
type TestRunStatus string type TestRunStatus string
// Indicates the results of a test run
const ( const (
TestRunUnknown TestRunStatus = "unknown" TestRunUnknown TestRunStatus = "unknown"
TestRunSuccess TestRunStatus = "success" TestRunSuccess TestRunStatus = "success"
@ -26,8 +28,10 @@ const (
TestRunRunning TestRunStatus = "running" TestRunRunning TestRunStatus = "running"
) )
// Strng converts a test run status to a printable string
func (x TestRunStatus) String() string { return string(x) } func (x TestRunStatus) String() string { return string(x) }
// TestRun describes the run of a test
type TestRun struct { type TestRun struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Status TestRunStatus `json:"status,omitempty"` Status TestRunStatus `json:"status,omitempty"`

@ -189,7 +189,7 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release {
name = "testrelease-" + string(rand.Intn(100)) name = "testrelease-" + string(rand.Intn(100))
} }
var version int = 1 version := 1
if opts.Version != 0 { if opts.Version != 0 {
version = opts.Version 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) { func (c *Client) KubernetesClientSet() (*kubernetes.Clientset, error) {
return c.Factory.KubernetesClientSet() return c.Factory.KubernetesClientSet()
} }

@ -242,7 +242,7 @@ func (c *Client) servicesReady(svc []v1.Service) bool {
return true 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 // the objective is not to perform validation here
func IsServiceIPSet(service *v1.Service) bool { func IsServiceIPSet(service *v1.Service) bool {
return service.Spec.ClusterIP != v1.ClusterIPNone && service.Spec.ClusterIP != "" return service.Spec.ClusterIP != v1.ClusterIPNone && service.Spec.ClusterIP != ""

Loading…
Cancel
Save