mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 10:19:50 +00:00
remove unused code in kubeadm error.go
This commit is contained in:
parent
15cd355281
commit
89dd2b2807
@ -33,10 +33,6 @@ const (
|
|||||||
ValidationExitCode = 3
|
ValidationExitCode = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
type debugError interface {
|
|
||||||
DebugError() (msg string, args []interface{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// fatal prints the message if set and then exits.
|
// fatal prints the message if set and then exits.
|
||||||
func fatal(msg string, code int) {
|
func fatal(msg string, code int) {
|
||||||
if len(msg) > 0 {
|
if len(msg) > 0 {
|
||||||
@ -56,7 +52,7 @@ func fatal(msg string, code int) {
|
|||||||
// This method is generic to the command in use and may be used by non-Kubectl
|
// This method is generic to the command in use and may be used by non-Kubectl
|
||||||
// commands.
|
// commands.
|
||||||
func CheckErr(err error) {
|
func CheckErr(err error) {
|
||||||
checkErr("", err, fatal)
|
checkErr(err, fatal)
|
||||||
}
|
}
|
||||||
|
|
||||||
// preflightError allows us to know if the error is a preflight error or not
|
// preflightError allows us to know if the error is a preflight error or not
|
||||||
@ -66,8 +62,8 @@ type preflightError interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// checkErr formats a given error as a string and calls the passed handleErr
|
// checkErr formats a given error as a string and calls the passed handleErr
|
||||||
// func with that string and an kubectl exit code.
|
// func with that string and an exit code.
|
||||||
func checkErr(prefix string, err error, handleErr func(string, int)) {
|
func checkErr(err error, handleErr func(string, int)) {
|
||||||
switch err.(type) {
|
switch err.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
return
|
return
|
||||||
|
@ -42,7 +42,7 @@ func TestCheckErr(t *testing.T) {
|
|||||||
|
|
||||||
for _, rt := range tokenTest {
|
for _, rt := range tokenTest {
|
||||||
codeReturned = 0
|
codeReturned = 0
|
||||||
checkErr("", rt.e, errHandle)
|
checkErr(rt.e, errHandle)
|
||||||
if codeReturned != rt.expected {
|
if codeReturned != rt.expected {
|
||||||
t.Errorf(
|
t.Errorf(
|
||||||
"failed checkErr:\n\texpected: %d\n\t actual: %d",
|
"failed checkErr:\n\texpected: %d\n\t actual: %d",
|
||||||
|
Loading…
Reference in New Issue
Block a user