mirror of https://github.com/k3s-io/k3s
fix golint for /pkg/util/ipconfig and /pkg/util/resourcecontainer-2
parent
0df5462db6
commit
ca74d32e4c
|
@ -380,7 +380,6 @@ pkg/util/env
|
||||||
pkg/util/file
|
pkg/util/file
|
||||||
pkg/util/goroutinemap/exponentialbackoff
|
pkg/util/goroutinemap/exponentialbackoff
|
||||||
pkg/util/initsystem
|
pkg/util/initsystem
|
||||||
pkg/util/ipconfig
|
|
||||||
pkg/util/iptables
|
pkg/util/iptables
|
||||||
pkg/util/iptables/testing
|
pkg/util/iptables/testing
|
||||||
pkg/util/labels
|
pkg/util/labels
|
||||||
|
@ -391,7 +390,6 @@ pkg/util/oom
|
||||||
pkg/util/parsers
|
pkg/util/parsers
|
||||||
pkg/util/procfs
|
pkg/util/procfs
|
||||||
pkg/util/removeall
|
pkg/util/removeall
|
||||||
pkg/util/resourcecontainer
|
|
||||||
pkg/util/rlimit
|
pkg/util/rlimit
|
||||||
pkg/util/selinux
|
pkg/util/selinux
|
||||||
pkg/util/sysctl
|
pkg/util/sysctl
|
||||||
|
|
|
@ -505,7 +505,7 @@ func (udp *udpProxySocket) ProxyLoop(service ServicePortPortalName, myInfo *serv
|
||||||
dnsSearch = []string{"", namespaceServiceDomain, serviceDomain, clusterDomain}
|
dnsSearch = []string{"", namespaceServiceDomain, serviceDomain, clusterDomain}
|
||||||
execer := exec.New()
|
execer := exec.New()
|
||||||
ipconfigInterface := ipconfig.New(execer)
|
ipconfigInterface := ipconfig.New(execer)
|
||||||
suffixList, err := ipconfigInterface.GetDnsSuffixSearchList()
|
suffixList, err := ipconfigInterface.GetDNSSuffixSearchList()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
for _, suffix := range suffixList {
|
for _, suffix := range suffixList {
|
||||||
dnsSearch = append(dnsSearch, suffix)
|
dnsSearch = append(dnsSearch, suffix)
|
||||||
|
|
|
@ -28,8 +28,8 @@ import (
|
||||||
|
|
||||||
// Interface is an injectable interface for running ipconfig commands. Implementations must be goroutine-safe.
|
// Interface is an injectable interface for running ipconfig commands. Implementations must be goroutine-safe.
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
// GetDnsSuffixSearchList returns the list of DNS suffix to search
|
// GetDNSSuffixSearchList returns the list of DNS suffix to search
|
||||||
GetDnsSuffixSearchList() ([]string, error)
|
GetDNSSuffixSearchList() ([]string, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -54,8 +54,8 @@ func New(exec utilexec.Interface) Interface {
|
||||||
return runner
|
return runner
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDnsSuffixSearchList returns the list of DNS suffix to search
|
// GetDNSSuffixSearchList returns the list of DNS suffix to search
|
||||||
func (runner *runner) GetDnsSuffixSearchList() ([]string, error) {
|
func (runner *runner) GetDNSSuffixSearchList() ([]string, error) {
|
||||||
// Parse the DNS suffix search list from ipconfig output
|
// Parse the DNS suffix search list from ipconfig output
|
||||||
// ipconfig /all on Windows displays the entry of DNS suffix search list
|
// ipconfig /all on Windows displays the entry of DNS suffix search list
|
||||||
// An example output contains:
|
// An example output contains:
|
||||||
|
|
|
@ -22,11 +22,11 @@ import (
|
||||||
"k8s.io/utils/exec"
|
"k8s.io/utils/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetDnsSuffixSearchList(t *testing.T) {
|
func TestGetDNSSuffixSearchList(t *testing.T) {
|
||||||
// Simple test
|
// Simple test
|
||||||
ipconfigInterface := New(exec.New())
|
ipconfigInterface := New(exec.New())
|
||||||
|
|
||||||
_, err := ipconfigInterface.GetDnsSuffixSearchList()
|
_, err := ipconfigInterface.GetDNSSuffixSearchList()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("expected success, got %v", err)
|
t.Errorf("expected success, got %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import (
|
||||||
"github.com/opencontainers/runc/libcontainer/configs"
|
"github.com/opencontainers/runc/libcontainer/configs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Creates resource-only containerName if it does not already exist and moves
|
// RunInResourceContainer creates resource-only containerName if it does not already exist and moves
|
||||||
// the current process to it.
|
// the current process to it.
|
||||||
//
|
//
|
||||||
// containerName must be an absolute container name.
|
// containerName must be an absolute container name.
|
||||||
|
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// RunInResourceContainer creates resource-only containerName unsupported.
|
||||||
func RunInResourceContainer(containerName string) error {
|
func RunInResourceContainer(containerName string) error {
|
||||||
return errors.New("resource-only containers unsupported in this platform")
|
return errors.New("resource-only containers unsupported in this platform")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue