Fix golint for pkg/probe

This change adds comments to exported things and renames the tcp,
http, and exec probe interfaces to just be Prober within their
namespace.

Issue #68026
This commit is contained in:
Jon Friesen
2018-09-12 14:13:19 -07:00
parent 426ef9d349
commit b971c3e200
7 changed files with 31 additions and 21 deletions

View File

@@ -23,16 +23,21 @@ import (
"github.com/golang/glog"
)
func New() ExecProber {
// New creates a Prober.
func New() Prober {
return execProber{}
}
type ExecProber interface {
// Prober is an interface defining the Probe object for container readiness/liveness checks.
type Prober interface {
Probe(e exec.Cmd) (probe.Result, string, error)
}
type execProber struct{}
// Probe executes a command to check the liveness/readiness of container
// from executing a command. Returns the Result status, command output, and
// errors if any.
func (pr execProber) Probe(e exec.Cmd) (probe.Result, string, error) {
data, err := e.CombinedOutput()
glog.V(4).Infof("Exec probe response: %q", string(data))
@@ -41,9 +46,8 @@ func (pr execProber) Probe(e exec.Cmd) (probe.Result, string, error) {
if ok {
if exit.ExitStatus() == 0 {
return probe.Success, string(data), nil
} else {
return probe.Failure, string(data), nil
}
return probe.Failure, string(data), nil
}
return probe.Unknown, "", err
}