diff --git a/internal/contrib/telemetrytest/telemetry_test.go b/internal/contrib/telemetrytest/telemetry_test.go index 1e85a5d640..5003f50b97 100644 --- a/internal/contrib/telemetrytest/telemetry_test.go +++ b/internal/contrib/telemetrytest/telemetry_test.go @@ -35,8 +35,7 @@ func (p *contribPkg) hasInstrumentationImport() bool { // TestTelemetryEnabled verifies that the expected contrib packages leverage instrumentation telemetry func TestTelemetryEnabled(t *testing.T) { - p := fmt.Sprintf("..%c..%c..%ccontrib", os.PathSeparator, os.PathSeparator, os.PathSeparator) - root, err := filepath.Abs(p) + root, err := filepath.Abs(filepath.Join("..", "..", "..", "contrib")) if err != nil { t.Fatal(err) } @@ -62,7 +61,6 @@ func testTelemetryEnabled(t *testing.T, contribPath string) error { t.Helper() t.Log(contribPath) pwd, err := os.Getwd() - separator := fmt.Sprintf("%c", os.PathSeparator) if err != nil { return err } @@ -72,7 +70,7 @@ func testTelemetryEnabled(t *testing.T, contribPath string) error { if err = os.Chdir(contribPath); err != nil { return err } - body, err := exec.Command("go", "list", "-json", "."+separator+"...").Output() + body, err := exec.Command("go", "list", "-json", "./...").Output() if err != nil { t.Log(string(body)) return err @@ -88,7 +86,7 @@ func testTelemetryEnabled(t *testing.T, contribPath string) error { packages = append(packages, out) } for _, pkg := range packages { - if strings.Contains(pkg.ImportPath, separator+"test") || strings.Contains(pkg.ImportPath, separator+"internal") { + if strings.Contains(pkg.ImportPath, "/test") || strings.Contains(pkg.ImportPath, "/internal") { continue } if !pkg.hasInstrumentationImport() {