Skip to content

Commit

Permalink
Fix/clarify some comments in the Go code (#1227)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonAlling authored and Andres Martinez Gotor committed Oct 16, 2019
1 parent 5f5bcc4 commit 417474e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var (

func init() {
appMutex = make(map[string]*sync.Mutex)
// List of posible statuses obtained from:
// List of possible statuses obtained from:
// https://github.com/helm/helm/blob/master/cmd/helm/list.go#L214
allReleaseStatuses = []release.Status_Code{
release.Status_UNKNOWN,
Expand Down Expand Up @@ -85,8 +85,8 @@ func (p *Proxy) getRelease(name, namespace string) (*release.Release, error) {
}

// We check that the release found is from the provided namespace.
// If `namespace` is an empty string we do not do that check
// This check check is to prevent users of for example updating releases that might be
// If `namespace` is an empty string we do not perform that check.
// This check is to prevent users from for example updating releases that might be
// in namespaces that they do not have access to.
if namespace != "" && release.Release.Namespace != namespace {
return nil, fmt.Errorf("Release %q not found in namespace %q", name, namespace)
Expand All @@ -95,7 +95,7 @@ func (p *Proxy) getRelease(name, namespace string) (*release.Release, error) {
return release.Release, nil
}

// GetReleaseStatus prints the status of the given release if exists
// GetReleaseStatus returns the status of the given release if it exists
func (p *Proxy) GetReleaseStatus(relName string) (release.Status_Code, error) {
status, err := p.helmClient.ReleaseStatus(relName)
if err == nil {
Expand Down Expand Up @@ -137,7 +137,7 @@ func (p *Proxy) ResolveManifestFromRelease(releaseName string, revision int32) (
return strings.TrimLeft(res.Release.Manifest, "\n"), nil
}

// Apply the same filtering than helm CLI
// Apply the same filtering as helm CLI
// Ref: https://github.com/helm/helm/blob/d3b69c1fc1ac62f1cc40f93fcd0cba275c0596de/cmd/helm/list.go#L173
func filterList(rels []*release.Release) []*release.Release {
idx := map[string]int32{}
Expand All @@ -162,7 +162,7 @@ func filterList(rels []*release.Release) []*release.Release {
return uniq
}

// getStatuses follows the same approach than helm CLI:
// getStatuses follows the same approach as helm CLI:
// https://github.com/helm/helm/blob/8761bb009f4eb4bcbbe7d20e434047e22b2046ad/cmd/helm/list.go#L212
func getStatuses(statusQuery string) []release.Status_Code {
if statusQuery == "" {
Expand Down Expand Up @@ -197,7 +197,7 @@ func getStatuses(statusQuery string) []release.Status_Code {
}
}

// ListReleases list releases in a specific namespace if given
// ListReleases lists releases in a specific namespace if given
func (p *Proxy) ListReleases(namespace string, releaseListLimit int, status string) ([]AppOverview, error) {
list, err := p.helmClient.ListReleases(
helm.ReleaseListLimit(releaseListLimit),
Expand Down
6 changes: 3 additions & 3 deletions pkg/yaml/yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ func ParseObjects(manifest string) ([]*unstructured.Unstructured, error) {
return nil, err
}

// It is also possible that the provided yaml file is empty from the point of view
// of the toJSON parser. For example if the yaml only contain comments.
// In which case the returned will be "null"
// It is also possible that the provided YAML file is empty from the point of view
// of the ToJSON parser (for example if the YAML only contains comments),
// in which case the returned value will be "null".
if bytes.Equal(jsondata, nullResult) {
continue
}
Expand Down

0 comments on commit 417474e

Please sign in to comment.