mirror of https://github.com/linkerd/linkerd2.git
fix: issues affecting code quality (#5827)
Fix various lint issues: - Remove unnecessary calls to fmt.Sprint - Fix check for empty string - Fix unnecessary calls to Printf - Combine multiple `append`s into a single call Signed-off-by: shubhendra <withshubh@gmail.com>
This commit is contained in:
parent
7f0529ed7c
commit
ad3b9accd8
|
@ -99,7 +99,7 @@ linkerd upgrade.`,
|
|||
return fmt.Errorf("Failed to render overrides: %s", err)
|
||||
}
|
||||
|
||||
fmt.Printf(string(overrides))
|
||||
fmt.Print(string(overrides))
|
||||
|
||||
return nil
|
||||
},
|
||||
|
|
|
@ -148,8 +148,7 @@ func startDocker(testNum int, wd string, testWorkRootDir string, tempCNINetDir s
|
|||
if _, ok := os.LookupEnv(cniConfName); ok {
|
||||
args = append(args, "-e", cniConfName)
|
||||
}
|
||||
args = append(args, dockerImage)
|
||||
args = append(args, "install-cni.sh")
|
||||
args = append(args, dockerImage, "install-cni.sh")
|
||||
|
||||
// Create a temporary log file to write docker command error log.
|
||||
errFile, err := os.Create(errFileName)
|
||||
|
|
|
@ -34,7 +34,7 @@ var (
|
|||
injectDisableAnnotationPresent: fmt.Sprintf("pod has the annotation \"%s:%s\"", k8s.ProxyInjectAnnotation, k8s.ProxyInjectDisabled),
|
||||
invalidInjectAnnotationWorkload: fmt.Sprintf("invalid value for annotation \"%s\" at workload", k8s.ProxyInjectAnnotation),
|
||||
invalidInjectAnnotationNamespace: fmt.Sprintf("invalid value for annotation \"%s\" at namespace", k8s.ProxyInjectAnnotation),
|
||||
disabledAutomountServiceAccountToken: fmt.Sprintf("automountServiceAccountToken set to \"false\""),
|
||||
disabledAutomountServiceAccountToken: "automountServiceAccountToken set to \"false\"",
|
||||
udpPortsEnabled: "UDP port(s) configured on pod spec",
|
||||
}
|
||||
)
|
||||
|
|
|
@ -208,7 +208,7 @@ func GetPodStatus(pod corev1.Pod) string {
|
|||
continue
|
||||
case container.State.Terminated != nil:
|
||||
// initialization is failed
|
||||
if len(container.State.Terminated.Reason) == 0 {
|
||||
if container.State.Terminated.Reason == "" {
|
||||
if container.State.Terminated.Signal != 0 {
|
||||
reason = fmt.Sprintf("Init:Signal:%d", container.State.Terminated.Signal)
|
||||
} else {
|
||||
|
|
|
@ -253,7 +253,7 @@ func writeEdgesToBuffer(rows []*pb.Edge, w *tabwriter.Writer, options *edgesOpti
|
|||
clientID := r.ClientId
|
||||
serverID := r.ServerId
|
||||
msg := r.NoIdentityMsg
|
||||
if len(msg) == 0 && options.outputFormat != jsonOutput {
|
||||
if msg == "" && options.outputFormat != jsonOutput {
|
||||
msg = okStatus
|
||||
}
|
||||
if len(clientID) > 0 {
|
||||
|
|
|
@ -205,7 +205,7 @@ func serverAuth(ctx context.Context, k8sAPI *k8s.API) (string, []string, string,
|
|||
|
||||
// copied from https://github.com/kubernetes/apiserver/blob/781c3cd1b3dc5b6f79c68ab0d16fe544600421ef/pkg/server/options/authentication.go#L360
|
||||
func deserializeStrings(in string) ([]string, error) {
|
||||
if len(in) == 0 {
|
||||
if in == "" {
|
||||
return nil, nil
|
||||
}
|
||||
var ret []string
|
||||
|
|
Loading…
Reference in New Issue