Fix Go vet errors for master golang
Co-authored-by: Rajalakshmi-Girish <rajalakshmi.girish1@ibm.com> Co-authored-by: Abhishek Kr Srivastav <Abhishek.kr.srivastav@ibm.com>
This commit is contained in:
committed by
Kishen Viswanathan
parent
7164c728c0
commit
9d10ddb060
@@ -620,7 +620,7 @@ func TestValidateCustomResource(t *testing.T) {
|
||||
}
|
||||
errs, _ := celValidator.Validate(context.TODO(), nil, structural, obj, oldObject, celconfig.RuntimeCELCostBudget)
|
||||
if len(errs) > 0 {
|
||||
t.Errorf(errs.ToAggregate().Error())
|
||||
t.Error(errs.ToAggregate().Error())
|
||||
}
|
||||
}
|
||||
for i, failingObject := range tt.failingObjects {
|
||||
|
||||
@@ -60,7 +60,7 @@ func TestLazyMapType(t *testing.T) {
|
||||
evalCounter++
|
||||
v, err := compileAndRun(env, activation, `{"a": "a"}`)
|
||||
if err != nil {
|
||||
return types.NewErr(err.Error())
|
||||
return types.NewErr("%s", err.Error())
|
||||
}
|
||||
return v
|
||||
})
|
||||
|
||||
@@ -2818,7 +2818,7 @@ func TestDeleteWithOptions(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
t.Logf(string(s))
|
||||
t.Log(string(s))
|
||||
}
|
||||
if simpleStorage.deleted != ID {
|
||||
t.Errorf("Unexpected delete: %s, expected %s", simpleStorage.deleted, ID)
|
||||
@@ -2858,7 +2858,7 @@ func TestDeleteWithOptionsQuery(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
t.Logf(string(s))
|
||||
t.Log(string(s))
|
||||
}
|
||||
if simpleStorage.deleted != ID {
|
||||
t.Fatalf("Unexpected delete: %s, expected %s", simpleStorage.deleted, ID)
|
||||
@@ -2901,7 +2901,7 @@ func TestDeleteWithOptionsQueryAndBody(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
t.Logf(string(s))
|
||||
t.Log(string(s))
|
||||
}
|
||||
if simpleStorage.deleted != ID {
|
||||
t.Errorf("Unexpected delete: %s, expected %s", simpleStorage.deleted, ID)
|
||||
|
||||
@@ -326,7 +326,7 @@ func TestSerializeObject(t *testing.T) {
|
||||
compressionEnabled: true,
|
||||
statusCode: http.StatusInternalServerError,
|
||||
out: smallPayload,
|
||||
outErrs: []error{fmt.Errorf(string(largePayload)), fmt.Errorf("bad2")},
|
||||
outErrs: []error{errors.New(string(largePayload)), errors.New("bad2")},
|
||||
mediaType: "application/json",
|
||||
req: &http.Request{
|
||||
Header: http.Header{
|
||||
|
||||
@@ -50,7 +50,7 @@ var (
|
||||
func handleError(w http.ResponseWriter, r *http.Request, err error) {
|
||||
errorMsg := fmt.Sprintf("Internal Server Error: %#v", r.RequestURI)
|
||||
http.Error(w, errorMsg, http.StatusInternalServerError)
|
||||
klog.Errorf(err.Error())
|
||||
klog.Error(err.Error())
|
||||
}
|
||||
|
||||
// requestWatermark is used to track maximal numbers of requests in a particular phase of handling
|
||||
|
||||
@@ -1603,7 +1603,7 @@ func verifyEvents(t *testing.T, w watch.Interface, events []watch.Event, strictO
|
||||
if !valid {
|
||||
t.Logf("(called from line %d)", line)
|
||||
for _, err := range errors {
|
||||
t.Errorf(err)
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ func (h *peerProxyHandler) WrapHandler(handler http.Handler) http.Handler {
|
||||
// TODO: maintain locally serviceable GVRs somewhere so that we dont have to
|
||||
// consult the storageversion-informed map for those
|
||||
if len(serviceableByResp.peerEndpoints) == 0 {
|
||||
klog.Errorf(fmt.Sprintf("GVR %v is not served by anything in this cluster", gvr))
|
||||
klog.Error(fmt.Sprintf("GVR %v is not served by anything in this cluster", gvr))
|
||||
handler.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package printers
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
@@ -36,13 +37,13 @@ func (p *JSONPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
|
||||
// we need an actual value in order to retrieve the package path for an object.
|
||||
// using reflect.Indirect indiscriminately is valid here, as all runtime.Objects are supposed to be pointers.
|
||||
if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
|
||||
return fmt.Errorf(InternalObjectPrinterErr)
|
||||
return errors.New(InternalObjectPrinterErr)
|
||||
}
|
||||
|
||||
switch obj := obj.(type) {
|
||||
case *metav1.WatchEvent:
|
||||
if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj.Object.Object)).Type().PkgPath()) {
|
||||
return fmt.Errorf(InternalObjectPrinterErr)
|
||||
return errors.New(InternalObjectPrinterErr)
|
||||
}
|
||||
data, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
|
||||
@@ -19,6 +19,7 @@ package printers
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
@@ -119,7 +120,7 @@ func (j *JSONPathPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
|
||||
// we need an actual value in order to retrieve the package path for an object.
|
||||
// using reflect.Indirect indiscriminately is valid here, as all runtime.Objects are supposed to be pointers.
|
||||
if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
|
||||
return fmt.Errorf(InternalObjectPrinterErr)
|
||||
return errors.New(InternalObjectPrinterErr)
|
||||
}
|
||||
|
||||
var queryObj interface{} = obj
|
||||
|
||||
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package printers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
@@ -52,7 +53,7 @@ func (p *NamePrinter) PrintObj(obj runtime.Object, w io.Writer) error {
|
||||
// using reflect.Indirect indiscriminately is valid here, as all runtime.Objects are supposed to be pointers.
|
||||
// we need an actual value in order to retrieve the package path for an object.
|
||||
if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
|
||||
return fmt.Errorf(InternalObjectPrinterErr)
|
||||
return errors.New(InternalObjectPrinterErr)
|
||||
}
|
||||
|
||||
if meta.IsListType(obj) {
|
||||
|
||||
@@ -18,6 +18,7 @@ package printers
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
@@ -61,7 +62,7 @@ func (p *GoTemplatePrinter) AllowMissingKeys(allow bool) {
|
||||
// PrintObj formats the obj with the Go Template.
|
||||
func (p *GoTemplatePrinter) PrintObj(obj runtime.Object, w io.Writer) error {
|
||||
if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
|
||||
return fmt.Errorf(InternalObjectPrinterErr)
|
||||
return errors.New(InternalObjectPrinterErr)
|
||||
}
|
||||
|
||||
var data []byte
|
||||
|
||||
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package printers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
@@ -42,7 +43,7 @@ func (p *YAMLPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
|
||||
// we need an actual value in order to retrieve the package path for an object.
|
||||
// using reflect.Indirect indiscriminately is valid here, as all runtime.Objects are supposed to be pointers.
|
||||
if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
|
||||
return fmt.Errorf(InternalObjectPrinterErr)
|
||||
return errors.New(InternalObjectPrinterErr)
|
||||
}
|
||||
|
||||
count := atomic.AddInt64(&p.printCount, 1)
|
||||
@@ -55,7 +56,7 @@ func (p *YAMLPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
|
||||
switch obj := obj.(type) {
|
||||
case *metav1.WatchEvent:
|
||||
if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj.Object.Object)).Type().PkgPath()) {
|
||||
return fmt.Errorf(InternalObjectPrinterErr)
|
||||
return errors.New(InternalObjectPrinterErr)
|
||||
}
|
||||
data, err := yaml.Marshal(obj)
|
||||
if err != nil {
|
||||
|
||||
@@ -1030,7 +1030,7 @@ func (b *Builder) visitByResource() *Result {
|
||||
if b.allNamespace {
|
||||
errMsg = "a resource cannot be retrieved by name across all namespaces"
|
||||
}
|
||||
return result.withError(fmt.Errorf(errMsg))
|
||||
return result.withError(errors.New(errMsg))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1093,7 +1093,7 @@ func (b *Builder) visitByName() *Result {
|
||||
if b.allNamespace {
|
||||
errMsg = "a resource cannot be retrieved by name across all namespaces"
|
||||
}
|
||||
return result.withError(fmt.Errorf(errMsg))
|
||||
return result.withError(errors.New(errMsg))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1873,7 +1873,7 @@ func TestHasNames(t *testing.T) {
|
||||
name: "test8",
|
||||
args: []string{"rc/foo", "bar"},
|
||||
expectedHasName: false,
|
||||
expectedError: fmt.Errorf("there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. '" + basename + " get resource/<resource_name>' instead of '" + basename + " get resource resource/<resource_name>'"),
|
||||
expectedError: errors.New("there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. '" + basename + " get resource/<resource_name>' instead of '" + basename + " get resource resource/<resource_name>'"),
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
||||
@@ -299,7 +299,7 @@ func TestHTTPProxy(t *testing.T) {
|
||||
}))
|
||||
defer testProxyServer.Close()
|
||||
|
||||
t.Logf(testProxyServer.URL)
|
||||
t.Log(testProxyServer.URL)
|
||||
|
||||
u, err := url.Parse(testProxyServer.URL)
|
||||
if err != nil {
|
||||
|
||||
@@ -115,5 +115,5 @@ func (d *errorDecoderV4) decode(message []byte) error {
|
||||
return errors.New("error stream protocol error: unknown error")
|
||||
}
|
||||
|
||||
return fmt.Errorf(status.Message)
|
||||
return errors.New(status.Message)
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ func TestTLSConfigKey(t *testing.T) {
|
||||
|
||||
shouldCacheA := valueA.Proxy == nil
|
||||
if shouldCacheA != canCacheA {
|
||||
t.Errorf("Unexpected canCache=false for " + nameA)
|
||||
t.Error("Unexpected canCache=false for " + nameA)
|
||||
}
|
||||
|
||||
configIsNotEmpty := !reflect.DeepEqual(*valueA, Config{})
|
||||
|
||||
@@ -138,7 +138,7 @@ func (h WebhookHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
admissionResponse, err = h.AdmissionHandler(in.Request)
|
||||
if err != nil {
|
||||
e := fmt.Sprintf("error generating admission response: %v", err)
|
||||
klog.Errorf(e)
|
||||
klog.Error(e)
|
||||
statusCode = http.StatusInternalServerError
|
||||
http.Error(w, e, statusCode)
|
||||
return
|
||||
|
||||
@@ -312,7 +312,7 @@ func (rc *RouteController) reconcile(ctx context.Context, nodes []*v1.Node, rout
|
||||
UID: types.UID(nodeName),
|
||||
Namespace: "",
|
||||
}, v1.EventTypeWarning, "FailedToCreateRoute", msg)
|
||||
klog.V(4).Infof(msg)
|
||||
klog.V(4).Info(msg)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ func TestReadLogs(t *testing.T) {
|
||||
err = ReadLogs(context.TODO(), nil, file.Name(), containerID, opts, fakeRuntimeService, stdoutBuf, stderrBuf)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf(err.Error())
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
if stderrBuf.Len() > 0 {
|
||||
t.Fatalf("Stderr: %v", stderrBuf.String())
|
||||
|
||||
@@ -206,7 +206,7 @@ func (o *AttachOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []s
|
||||
|
||||
o.GetPodTimeout, err = cmdutil.GetPodRunningTimeoutFlag(cmd)
|
||||
if err != nil {
|
||||
return cmdutil.UsageErrorf(cmd, err.Error())
|
||||
return cmdutil.UsageErrorf(cmd, "%s", err.Error())
|
||||
}
|
||||
|
||||
o.Builder = f.NewBuilder
|
||||
|
||||
@@ -988,6 +988,6 @@ func cmpFileData(t *testing.T, filePath, data string) {
|
||||
type testWriter testing.T
|
||||
|
||||
func (t *testWriter) Write(p []byte) (n int, err error) {
|
||||
t.Logf(string(p))
|
||||
t.Log(string(p))
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package create
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -399,12 +400,12 @@ func parsePorts(portString string) (int32, intstr.IntOrString, error) {
|
||||
var targetPort intstr.IntOrString
|
||||
if portNum, err := strconv.Atoi(portStringSlice[1]); err != nil {
|
||||
if errs := validation.IsValidPortName(portStringSlice[1]); len(errs) != 0 {
|
||||
return 0, intstr.FromInt32(0), fmt.Errorf(strings.Join(errs, ","))
|
||||
return 0, intstr.FromInt32(0), errors.New(strings.Join(errs, ","))
|
||||
}
|
||||
targetPort = intstr.FromString(portStringSlice[1])
|
||||
} else {
|
||||
if errs := validation.IsValidPortNum(portNum); len(errs) != 0 {
|
||||
return 0, intstr.FromInt32(0), fmt.Errorf(strings.Join(errs, ","))
|
||||
return 0, intstr.FromInt32(0), errors.New(strings.Join(errs, ","))
|
||||
}
|
||||
targetPort = intstr.FromInt32(int32(portNum))
|
||||
}
|
||||
|
||||
@@ -531,7 +531,7 @@ func (o *DeleteOptions) confirmation(infos []*resource.Info) bool {
|
||||
|
||||
fmt.Fprintf(o.Out, "%s/%s\n", kindString, info.Name)
|
||||
}
|
||||
fmt.Fprintf(o.Out, i18n.T("Do you want to continue?")+" (y/n): ")
|
||||
fmt.Fprint(o.Out, i18n.T("Do you want to continue?")+" (y/n): ")
|
||||
var input string
|
||||
_, err := fmt.Fscan(o.In, &input)
|
||||
if err != nil {
|
||||
|
||||
@@ -161,7 +161,7 @@ func NewCmdDiff(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Co
|
||||
// command it means changes were found.
|
||||
// Thus, it should return status code greater than 1.
|
||||
cmd.SetFlagErrorFunc(func(command *cobra.Command, err error) error {
|
||||
cmdutil.CheckDiffErr(cmdutil.UsageErrorf(cmd, err.Error()))
|
||||
cmdutil.CheckDiffErr(cmdutil.UsageErrorf(cmd, "%s", err.Error()))
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ func (o *DrainCmdOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args [
|
||||
var err error
|
||||
|
||||
if len(args) == 0 && !cmd.Flags().Changed("selector") {
|
||||
return cmdutil.UsageErrorf(cmd, fmt.Sprintf("USAGE: %s [flags]", cmd.Use))
|
||||
return cmdutil.UsageErrorf(cmd, "USAGE: %s [flags]", cmd.Use)
|
||||
}
|
||||
if len(args) > 0 && len(o.drainer.Selector) > 0 {
|
||||
return cmdutil.UsageErrorf(cmd, "error: cannot specify both a node name and a --selector option")
|
||||
|
||||
@@ -216,7 +216,7 @@ func (p *ExecOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, argsIn []s
|
||||
|
||||
p.GetPodTimeout, err = cmdutil.GetPodRunningTimeoutFlag(cmd)
|
||||
if err != nil {
|
||||
return cmdutil.UsageErrorf(cmd, err.Error())
|
||||
return cmdutil.UsageErrorf(cmd, "%s", err.Error())
|
||||
}
|
||||
|
||||
p.Builder = f.NewBuilder
|
||||
|
||||
@@ -19,6 +19,7 @@ package get
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
@@ -161,7 +162,7 @@ func (s *CustomColumnsPrinter) PrintObj(obj runtime.Object, out io.Writer) error
|
||||
// we need an actual value in order to retrieve the package path for an object.
|
||||
// using reflect.Indirect indiscriminately is valid here, as all runtime.Objects are supposed to be pointers.
|
||||
if printers.InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
|
||||
return fmt.Errorf(printers.InternalObjectPrinterErr)
|
||||
return errors.New(printers.InternalObjectPrinterErr)
|
||||
}
|
||||
|
||||
if _, found := out.(*tabwriter.Writer); !found {
|
||||
@@ -210,7 +211,7 @@ func (s *CustomColumnsPrinter) printOneObject(obj runtime.Object, parsers []*jso
|
||||
switch u := obj.(type) {
|
||||
case *metav1.WatchEvent:
|
||||
if printers.InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(u.Object.Object)).Type().PkgPath()) {
|
||||
return fmt.Errorf(printers.InternalObjectPrinterErr)
|
||||
return errors.New(printers.InternalObjectPrinterErr)
|
||||
}
|
||||
unstructuredObject, err := runtime.DefaultUnstructuredConverter.ToUnstructured(u.Object.Object)
|
||||
if err != nil {
|
||||
|
||||
@@ -290,7 +290,7 @@ func (o *GetOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []stri
|
||||
usageString = fmt.Sprintf("%s\nUse \"%s explain <resource>\" for a detailed description of that resource (e.g. %[2]s explain pods).", usageString, fullCmdName)
|
||||
}
|
||||
|
||||
return cmdutil.UsageErrorf(cmd, usageString)
|
||||
return cmdutil.UsageErrorf(cmd, "%s", usageString)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ func (o *PortForwardOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, arg
|
||||
|
||||
getPodTimeout, err := cmdutil.GetPodRunningTimeoutFlag(cmd)
|
||||
if err != nil {
|
||||
return cmdutil.UsageErrorf(cmd, err.Error())
|
||||
return cmdutil.UsageErrorf(cmd, "%s", err.Error())
|
||||
}
|
||||
|
||||
resourceName := args[0]
|
||||
|
||||
@@ -183,7 +183,7 @@ func (o *TaintOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []st
|
||||
}
|
||||
|
||||
if o.taintsToAdd, o.taintsToRemove, err = parseTaints(taintArgs); err != nil {
|
||||
return cmdutil.UsageErrorf(cmd, err.Error())
|
||||
return cmdutil.UsageErrorf(cmd, "%s", err.Error())
|
||||
}
|
||||
o.builder = f.NewBuilder().
|
||||
WithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...).
|
||||
|
||||
@@ -243,7 +243,7 @@ func statusCausesToAggrError(scs []metav1.StatusCause) utilerrors.Aggregate {
|
||||
// commands.
|
||||
func StandardErrorMessage(err error) (string, bool) {
|
||||
if debugErr, ok := err.(debugError); ok {
|
||||
klog.V(4).Infof(debugErr.DebugError())
|
||||
klog.V(4).Info(debugErr.DebugError())
|
||||
}
|
||||
status, isStatus := err.(apierrors.APIStatus)
|
||||
switch {
|
||||
|
||||
@@ -3521,8 +3521,8 @@ Events: <none>
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
if out != test.output {
|
||||
t.Logf(out)
|
||||
t.Logf(test.output)
|
||||
t.Log(out)
|
||||
t.Log(test.output)
|
||||
t.Errorf("expected: \n%q\n but got output: \n%q\n", test.output, out)
|
||||
}
|
||||
})
|
||||
@@ -5175,7 +5175,7 @@ Parameters:
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
if out != expectedOut {
|
||||
t.Logf(out)
|
||||
t.Log(out)
|
||||
t.Errorf("expected : %q\n but got output:\n %q", test.output, out)
|
||||
}
|
||||
})
|
||||
@@ -6354,7 +6354,7 @@ Events: <none>` + "\n",
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
if out != tc.output {
|
||||
t.Logf(out)
|
||||
t.Log(out)
|
||||
t.Errorf("expected :\n%s\nbut got output:\n%s", tc.output, out)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -62,7 +62,7 @@ func (p *HelpFlagPrinter) PrintHelpFlag(flag *flag.Flag) {
|
||||
}
|
||||
appendTabStr := strings.ReplaceAll(wrappedStr, "\n", "\n\t")
|
||||
|
||||
fmt.Fprintf(p.out, appendTabStr+"\n\n")
|
||||
fmt.Fprint(p.out, appendTabStr+"\n\n")
|
||||
}
|
||||
|
||||
// writeFlag will output the help flag based
|
||||
|
||||
@@ -623,7 +623,7 @@ func (mounter *SafeFormatAndMount) formatAndMountSensitive(source string, target
|
||||
sensitiveOptionsLog := sanitizedOptionsForLogging(options, sensitiveOptions)
|
||||
detailedErr := fmt.Sprintf("format of disk %q failed: type:(%q) target:(%q) options:(%q) errcode:(%v) output:(%v) ", source, fstype, target, sensitiveOptionsLog, err, string(output))
|
||||
klog.Error(detailedErr)
|
||||
return NewMountError(FormatFailed, detailedErr)
|
||||
return NewMountError(FormatFailed, "%s", detailedErr)
|
||||
}
|
||||
|
||||
klog.Infof("Disk successfully formatted (mkfs): %s - %s %s", fstype, source, target)
|
||||
@@ -646,7 +646,7 @@ func (mounter *SafeFormatAndMount) formatAndMountSensitive(source string, target
|
||||
// Mount the disk
|
||||
klog.V(4).Infof("Attempting to mount disk %s in %s format at %s", source, fstype, target)
|
||||
if err := mounter.MountSensitive(source, target, fstype, options, sensitiveOptions); err != nil {
|
||||
return NewMountError(mountErrorValue, err.Error())
|
||||
return NewMountError(mountErrorValue, "%s", err.Error())
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user