Skip to content

Commit 2392326

Browse files
committed
internal/helm: doc block nitpicks
Signed-off-by: Hidde Beydals <hello@hidde.co>
1 parent 88ff049 commit 2392326

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

internal/helm/chart/dependency_manager.go

+10-7
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ type GetChartRepositoryCallback func(url string) (*repository.ChartRepository, e
4141

4242
// DependencyManager manages dependencies for a Helm chart.
4343
type DependencyManager struct {
44-
// repositories contains a map of Index indexed by their
45-
// normalized URL. It is used as a lookup table for missing
46-
// dependencies.
44+
// repositories contains a map of repository.ChartRepository objects
45+
// indexed by their repository.NormalizeURL.
46+
// It is consulted as a lookup table for missing dependencies, based on
47+
// the (repository) URL the dependency refers to.
4748
repositories map[string]*repository.ChartRepository
4849

4950
// getRepositoryCallback can be set to an on-demand GetChartRepositoryCallback
50-
// which returned result is cached to repositories.
51+
// whose returned result is cached to repositories.
5152
getRepositoryCallback GetChartRepositoryCallback
5253

5354
// concurrent is the number of concurrent chart-add operations during
@@ -91,6 +92,8 @@ func NewDependencyManager(opts ...DependencyManagerOption) *DependencyManager {
9192
return dm
9293
}
9394

95+
// Clear iterates over the repositories, calling Unload and RemoveCache on all
96+
// items. It returns a collection of (cache removal) errors.
9497
func (dm *DependencyManager) Clear() []error {
9598
var errs []error
9699
for _, v := range dm.repositories {
@@ -294,9 +297,9 @@ func (dm *DependencyManager) secureLocalChartPath(ref LocalReference, dep *helmc
294297
return securejoin.SecureJoin(ref.WorkDir, filepath.Join(relPath, localUrl.Host, localUrl.Path))
295298
}
296299

297-
// collectMissing returns a map with reqs that are missing from current,
298-
// indexed by their alias or name. All dependencies of a chart are present
299-
// if len of returned map == 0.
300+
// collectMissing returns a map with dependencies from reqs that are missing
301+
// from current, indexed by their alias or name. All dependencies of a chart
302+
// are present if len of returned map == 0.
300303
func collectMissing(current []*helmchart.Chart, reqs []*helmchart.Dependency) map[string]*helmchart.Dependency {
301304
// If the number of dependencies equals the number of requested
302305
// dependencies, there are no missing dependencies

internal/helm/chart/metadata_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2020 The Flux authors
2+
Copyright 2021 The Flux authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

internal/helm/repository/chart_repository.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ func (r *ChartRepository) CacheIndex() (string, error) {
285285

286286
// StrategicallyLoadIndex lazy-loads the Index from CachePath using
287287
// LoadFromCache if it does not HasIndex.
288-
// If it not HasCacheFile, a cache attempt is made using CacheIndex
288+
// If not HasCacheFile, a cache attempt is made using CacheIndex
289289
// before continuing to load.
290290
func (r *ChartRepository) StrategicallyLoadIndex() (err error) {
291291
if r.HasIndex() {
@@ -350,7 +350,7 @@ func (r *ChartRepository) HasCacheFile() bool {
350350
}
351351

352352
// Unload can be used to signal the Go garbage collector the Index can
353-
// be freed from memory if the Index object is expected to
353+
// be freed from memory if the ChartRepository object is expected to
354354
// continue to exist in the stack for some time.
355355
func (r *ChartRepository) Unload() {
356356
if r == nil {

0 commit comments

Comments
 (0)