using filepath instead of path

This commit is contained in:
Matias Manavella
2020-09-16 18:25:15 -03:00
parent a57894962d
commit eb0f692aa0
3 changed files with 6 additions and 6 deletions

View File

@@ -3,7 +3,7 @@ package analyzer
import (
"encoding/json"
"fmt"
"path"
"path/filepath"
"github.com/pkg/errors"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
@@ -11,7 +11,7 @@ import (
)
func analyzeDeploymentStatus(analyzer *troubleshootv1beta2.DeploymentStatus, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) {
collected, err := getCollectedFileContents(path.Join("cluster-resources", "deployments", fmt.Sprintf("%s.json", analyzer.Namespace)))
collected, err := getCollectedFileContents(filepath.Join("cluster-resources", "deployments", fmt.Sprintf("%s.json", analyzer.Namespace)))
if err != nil {
return nil, errors.Wrap(err, "failed to read collected deployments from namespace")
}

View File

@@ -3,14 +3,14 @@ package analyzer
import (
"encoding/json"
"fmt"
"path"
"path/filepath"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
)
func analyzeIngress(analyzer *troubleshootv1beta2.Ingress, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) {
ingressData, err := getCollectedFileContents(path.Join("cluster-resources", "ingress", fmt.Sprintf("%s.json", analyzer.Namespace)))
ingressData, err := getCollectedFileContents(filepath.Join("cluster-resources", "ingress", fmt.Sprintf("%s.json", analyzer.Namespace)))
if err != nil {
return nil, err
}

View File

@@ -3,7 +3,7 @@ package analyzer
import (
"encoding/json"
"fmt"
"path"
"path/filepath"
"github.com/pkg/errors"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
@@ -11,7 +11,7 @@ import (
)
func analyzeStatefulsetStatus(analyzer *troubleshootv1beta2.StatefulsetStatus, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) {
collected, err := getCollectedFileContents(path.Join("cluster-resources", "statefulsets", fmt.Sprintf("%s.json", analyzer.Namespace)))
collected, err := getCollectedFileContents(filepath.Join("cluster-resources", "statefulsets", fmt.Sprintf("%s.json", analyzer.Namespace)))
if err != nil {
return nil, errors.Wrap(err, "failed to read collected statefulsets from namespace")
}