diff --git a/pkg/generate/errorcodes.go b/pkg/generate/errorcodes.go index b6bff48e46..a81decdce4 100644 --- a/pkg/generate/errorcodes.go +++ b/pkg/generate/errorcodes.go @@ -30,6 +30,7 @@ import ( "k8s.io/minikube/pkg/minikube/out" ) +// ErrorCodes generates error codes func ErrorCodes(docPath string, pathsToCheck []string) error { buf := bytes.NewBuffer([]byte{}) date := time.Now().Format("2006-01-02") diff --git a/pkg/generate/testdocs.go b/pkg/generate/testdocs.go index 5c57ccd464..46bb42d5a7 100644 --- a/pkg/generate/testdocs.go +++ b/pkg/generate/testdocs.go @@ -33,6 +33,7 @@ import ( "k8s.io/minikube/pkg/minikube/out" ) +// TestDocs generates list of tests func TestDocs(docPath string, pathToCheck string) error { buf := bytes.NewBuffer([]byte{}) date := time.Now().Format("2006-01-02") diff --git a/pkg/minikube/assets/aliyun_mirror.go b/pkg/minikube/assets/aliyun_mirror.go index c491cb7874..9d7e633205 100644 --- a/pkg/minikube/assets/aliyun_mirror.go +++ b/pkg/minikube/assets/aliyun_mirror.go @@ -24,6 +24,7 @@ import ( "k8s.io/minikube/deploy/addons" ) +// AliyunMirror list of images from Aliyun mirror var AliyunMirror = loadAliyunMirror() func loadAliyunMirror() map[string]string { @@ -39,6 +40,7 @@ func loadAliyunMirror() map[string]string { return mirror } +// FixAddonImagesAndRegistries fixes images & registries in addon func FixAddonImagesAndRegistries(addon *Addon, images map[string]string, registries map[string]string) (customImages, customRegistries map[string]string) { customImages = make(map[string]string) customRegistries = make(map[string]string) diff --git a/pkg/minikube/assets/vm_assets.go b/pkg/minikube/assets/vm_assets.go index cf9e6e5485..d9c5f8d924 100644 --- a/pkg/minikube/assets/vm_assets.go +++ b/pkg/minikube/assets/vm_assets.go @@ -60,6 +60,8 @@ type CopyableFile interface { } type writeFn func(d []byte) (n int, err error) + +// BaseCopyableFile is something that can be copied and written type BaseCopyableFile struct { ReadableFile @@ -69,26 +71,32 @@ type BaseCopyableFile struct { targetName string } +// Write is for write something into the file func (r *BaseCopyableFile) Write(d []byte) (n int, err error) { return r.writer(d) } +// SetLength is for setting the length func (r *BaseCopyableFile) SetLength(length int) { r.length = length } +// GetTargetPath returns target path func (r *BaseCopyableFile) GetTargetPath() string { return filepath.Join(r.GetTargetDir(), r.GetTargetName()) } +// GetTargetDir returns target dir func (r *BaseCopyableFile) GetTargetDir() string { return r.targetDir } +// GetTargetName returns target name func (r *BaseCopyableFile) GetTargetName() string { return r.targetName } +// NewBaseCopyableFile creates a new instance of BaseCopyableFile func NewBaseCopyableFile(source ReadableFile, writer writeFn, targetDir, targetName string) *BaseCopyableFile { return &BaseCopyableFile{ ReadableFile: source, diff --git a/pkg/minikube/cluster/mount.go b/pkg/minikube/cluster/mount.go index 14dff6db0b..34d898ed48 100644 --- a/pkg/minikube/cluster/mount.go +++ b/pkg/minikube/cluster/mount.go @@ -58,9 +58,9 @@ type mountRunner interface { const ( // MountErrorUnknown failed with unknown error MountErrorUnknown = iota - // MountErrorConnect + // MountErrorConnect failed to connect MountErrorConnect - // MountErrorChmod + // MountErrorChmod failed to chmod MountErrorChmod ) diff --git a/pkg/minikube/cni/cilium.go b/pkg/minikube/cni/cilium.go index 4b6932eb92..2bd478c978 100644 --- a/pkg/minikube/cni/cilium.go +++ b/pkg/minikube/cni/cilium.go @@ -808,7 +808,7 @@ func (c Cilium) CIDR() string { return DefaultPodCIDR } -// GenerateKubeadmYAML generates the .yaml file +// GenerateCiliumYAML generates the .yaml file func GenerateCiliumYAML() ([]byte, error) { podCIDR := DefaultPodCIDR diff --git a/pkg/minikube/command/fake_runner.go b/pkg/minikube/command/fake_runner.go index 3374f1f91a..00bb20af36 100644 --- a/pkg/minikube/command/fake_runner.go +++ b/pkg/minikube/command/fake_runner.go @@ -142,6 +142,7 @@ func (f *FakeCommandRunner) Copy(file assets.CopyableFile) error { return nil } +// CopyFrom copy content from file to the stored map. func (f *FakeCommandRunner) CopyFrom(file assets.CopyableFile) error { v, ok := f.fileMap.Load(file.GetSourcePath()) if !ok { @@ -161,6 +162,7 @@ func (f *FakeCommandRunner) Remove(file assets.CopyableFile) error { return nil } +// ReadableFile implements interface (without implementation) func (f *FakeCommandRunner) ReadableFile(sourcePath string) (assets.ReadableFile, error) { return nil, nil } diff --git a/pkg/minikube/command/ssh_runner.go b/pkg/minikube/command/ssh_runner.go index 4dde2356ae..561fc824d2 100644 --- a/pkg/minikube/command/ssh_runner.go +++ b/pkg/minikube/command/ssh_runner.go @@ -44,7 +44,7 @@ var ( ) // SSHRunner runs commands through SSH. - +// // It implements the CommandRunner interface. type SSHRunner struct { d drivers.Driver @@ -499,6 +499,7 @@ func (s *SSHRunner) CopyFrom(f assets.CopyableFile) error { return g.Wait() } +// ReadableFile returns assets.ReadableFile for the sourcePath (via `stat` command) func (s *SSHRunner) ReadableFile(sourcePath string) (assets.ReadableFile, error) { klog.V(4).Infof("NewsshReadableFile: %s -> %s", sourcePath) diff --git a/pkg/minikube/driver/driver.go b/pkg/minikube/driver/driver.go index 3a76001a00..34e277009a 100644 --- a/pkg/minikube/driver/driver.go +++ b/pkg/minikube/driver/driver.go @@ -172,6 +172,7 @@ func IsSSH(name string) bool { return name == SSH } +// AllowsPreload returns if preload is allowed for the driver func AllowsPreload(driverName string) bool { return !BareMetal(driverName) && !IsSSH(driverName) } diff --git a/pkg/minikube/image/image.go b/pkg/minikube/image/image.go index 7076f2ca46..5603a8022f 100644 --- a/pkg/minikube/image/image.go +++ b/pkg/minikube/image/image.go @@ -203,6 +203,7 @@ func imagePathInCache(img string) string { return f } +// UploadCachedImage uploads cached image func UploadCachedImage(imgName string) error { tag, err := name.NewTag(imgName, name.WeakValidation) if err != nil { diff --git a/pkg/minikube/notify/notify.go b/pkg/minikube/notify/notify.go index 1643ea3fcd..9c8e3aaaef 100644 --- a/pkg/minikube/notify/notify.go +++ b/pkg/minikube/notify/notify.go @@ -47,7 +47,7 @@ func MaybePrintUpdateTextFromGithub() { maybePrintUpdateText(GithubMinikubeReleasesURL, GithubMinikubeBetaReleasesURL, lastUpdateCheckFilePath) } -// MaybePrintUpdateTextFromGithub prints update text if needed, from Aliyun mirror +// MaybePrintUpdateTextFromAliyunMirror prints update text if needed, from Aliyun mirror func MaybePrintUpdateTextFromAliyunMirror() { maybePrintUpdateText(GithubMinikubeReleasesAliyunURL, GithubMinikubeBetaReleasesAliyunURL, lastUpdateCheckFilePath) }