Merge pull request #13094 from ekalinin/fix-golint

Fix golint warnings
pull/13101/head
Steven Powell 2021-12-06 09:26:26 -08:00 committed by GitHub
commit 295c4362bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 22 additions and 5 deletions

View File

@ -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")

View File

@ -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")

View File

@ -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)

View File

@ -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,

View File

@ -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
)

View File

@ -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

View File

@ -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
}

View File

@ -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)

View File

@ -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)
}

View File

@ -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 {

View File

@ -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)
}