Skip to content

Commit 6d7b876

Browse files
committed
build: use DownloadFileFromKnownURL
We already have the URLs defined in checksums.txt, might as well use them.
1 parent 0abafba commit 6d7b876

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

build/ci.go

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -331,15 +331,10 @@ func doTest(cmdline []string) {
331331

332332
// downloadSpecTestFixtures downloads and extracts the execution-spec-tests fixtures.
333333
func downloadSpecTestFixtures(csdb *download.ChecksumDB, cachedir string) string {
334-
executionSpecTestsVersion, err := csdb.FindVersion("spec-tests")
335-
if err != nil {
336-
log.Fatal(err)
337-
}
338334
ext := ".tar.gz"
339335
base := "fixtures_pectra-devnet-6" // TODO(s1na) rename once the version becomes part of the filename
340-
url := fmt.Sprintf("https://github.com/ethereum/execution-spec-tests/releases/download/%s/%s%s", executionSpecTestsVersion, base, ext)
341336
archivePath := filepath.Join(cachedir, base+ext)
342-
if err := csdb.DownloadFile(url, archivePath); err != nil {
337+
if err := csdb.DownloadFileFromKnownURL(archivePath); err != nil {
343338
log.Fatal(err)
344339
}
345340
if err := build.ExtractArchive(archivePath, executionSpecTestsDir); err != nil {
@@ -452,17 +447,15 @@ func downloadLinter(cachedir string) string {
452447
}
453448
arch := runtime.GOARCH
454449
ext := ".tar.gz"
455-
456450
if runtime.GOOS == "windows" {
457451
ext = ".zip"
458452
}
459453
if arch == "arm" {
460454
arch += "v" + os.Getenv("GOARM")
461455
}
462456
base := fmt.Sprintf("golangci-lint-%s-%s-%s", version, runtime.GOOS, arch)
463-
url := fmt.Sprintf("https://github.com/golangci/golangci-lint/releases/download/v%s/%s%s", version, base, ext)
464457
archivePath := filepath.Join(cachedir, base+ext)
465-
if err := csdb.DownloadFile(url, archivePath); err != nil {
458+
if err := csdb.DownloadFileFromKnownURL(archivePath); err != nil {
466459
log.Fatal(err)
467460
}
468461
if err := build.ExtractArchive(archivePath, cachedir); err != nil {
@@ -511,10 +504,8 @@ func downloadProtocGenGo(cachedir string) string {
511504
archiveName += ".tar.gz"
512505
}
513506

514-
url := fmt.Sprintf("https://github.com/protocolbuffers/protobuf-go/releases/download/v%s/%s", version, archiveName)
515-
516507
archivePath := path.Join(cachedir, archiveName)
517-
if err := csdb.DownloadFile(url, archivePath); err != nil {
508+
if err := csdb.DownloadFileFromKnownURL(archivePath); err != nil {
518509
log.Fatal(err)
519510
}
520511
extractDest := filepath.Join(cachedir, baseName)
@@ -544,10 +535,8 @@ func downloadProtoc(cachedir string) string {
544535

545536
fileName := fmt.Sprintf("protoc-%s-%s", version, baseName)
546537
archiveFileName := fileName + ".zip"
547-
url := fmt.Sprintf("https://github.com/protocolbuffers/protobuf/releases/download/v%s/%s", version, archiveFileName)
548538
archivePath := filepath.Join(cachedir, archiveFileName)
549-
550-
if err := csdb.DownloadFile(url, archivePath); err != nil {
539+
if err := csdb.DownloadFileFromKnownURL(archivePath); err != nil {
551540
log.Fatal(err)
552541
}
553542
extractDest := filepath.Join(cachedir, fileName)
@@ -836,9 +825,8 @@ func downloadGoBootstrapSources(cachedir string) []string {
836825
log.Fatal(err)
837826
}
838827
file := fmt.Sprintf("go%s.src.tar.gz", gobootVersion)
839-
url := "https://dl.google.com/go/" + file
840828
dst := filepath.Join(cachedir, file)
841-
if err := csdb.DownloadFile(url, dst); err != nil {
829+
if err := csdb.DownloadFileFromKnownURL(url, dst); err != nil {
842830
log.Fatal(err)
843831
}
844832
bundles = append(bundles, dst)
@@ -854,9 +842,8 @@ func downloadGoSources(cachedir string) string {
854842
log.Fatal(err)
855843
}
856844
file := fmt.Sprintf("go%s.src.tar.gz", dlgoVersion)
857-
url := "https://dl.google.com/go/" + file
858845
dst := filepath.Join(cachedir, file)
859-
if err := csdb.DownloadFile(url, dst); err != nil {
846+
if err := csdb.DownloadFileFromKnownURL(url, dst); err != nil {
860847
log.Fatal(err)
861848
}
862849
return dst

0 commit comments

Comments
 (0)