From af1e69e5947e000ae8553f71d415ebe487b5b163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=A0trauch?= Date: Mon, 24 Apr 2023 22:35:58 +0200 Subject: [PATCH] Fix symlink --- containers/tools.go | 2 ++ containers/types_test.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/containers/tools.go b/containers/tools.go index b302930..ebf9f87 100644 --- a/containers/tools.go +++ b/containers/tools.go @@ -140,6 +140,8 @@ func CPUMemoryStats(applist *[]apps.App, sample int) (*[]apps.App, error) { } func getTechAndVersion(symlink string) (*TechInfo, error) { + symlink = strings.TrimSuffix(symlink, "/bin") + link, err := os.Readlink(symlink) if err != nil { return nil, fmt.Errorf("error reading symlink: %w", err) diff --git a/containers/types_test.go b/containers/types_test.go index 1eb8434..f6762ca 100644 --- a/containers/types_test.go +++ b/containers/types_test.go @@ -11,7 +11,7 @@ func TestGetTechAndVersion(t *testing.T) { tempDir := t.TempDir() // Create a fake language directory with version in the temporary directory - fakeLangDir := filepath.Join(tempDir, "techs", "python-3.10.4") + fakeLangDir := filepath.Join(tempDir, "techs", "python-3.10.4", "bin") err := os.MkdirAll(fakeLangDir, 0755) if err != nil { t.Fatalf("Failed to create fake language directory: %v", err)