Skip to content

Commit d543fc7

Browse files
fix: Read go.mod from correct location in testarchive (#3551)
1 parent 226c668 commit d543fc7

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

integration/testarchive/downloader_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func TestGoDownloader(t *testing.T) {
6969
tmpDir := t.TempDir()
7070

7171
for _, arch := range []string{"arm64", "amd64"} {
72-
err := testarchive.GoDownloader{Arch: arch, BinDir: tmpDir}.Download()
72+
err := testarchive.GoDownloader{Arch: arch, BinDir: tmpDir, RepoRoot: "../.."}.Download()
7373
require.NoError(t, err)
7474

7575
entries, err := os.ReadDir(filepath.Join(tmpDir, arch))

internal/testarchive/archive.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func CreateArchive(archiveDir, binDir, repoRoot string) error {
106106
// The Databricks platform explicitly does not provide any guarantees around
107107
// the CPU architecture to keep the door open for future optimizations.
108108
downloaders := []downloader{
109-
GoDownloader{Arch: "amd64", BinDir: binDir},
109+
GoDownloader{Arch: "amd64", BinDir: binDir, RepoRoot: repoRoot},
110110
UvDownloader{Arch: "amd64", BinDir: binDir},
111111
JqDownloader{Arch: "amd64", BinDir: binDir},
112112

internal/testarchive/go.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ type downloader interface {
1515
}
1616

1717
type GoDownloader struct {
18-
BinDir string
19-
Arch string
18+
BinDir string
19+
Arch string
20+
RepoRoot string
2021
}
2122

2223
func (g GoDownloader) readGoVersionFromMod() (string, error) {
23-
goModPath := filepath.Join("..", "..", "go.mod")
24+
goModPath := filepath.Join(g.RepoRoot, "go.mod")
2425

2526
file, err := os.Open(goModPath)
2627
if err != nil {

0 commit comments

Comments
 (0)