internal/linker: use go/version to get the Go major version

pull/908/head
Daniel Martí 3 months ago
parent bbd6792669
commit 60634f7476
No known key found for this signature in database

@ -10,6 +10,7 @@ import (
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"fmt" "fmt"
"go/version"
"io" "io"
"io/fs" "io/fs"
"os" "os"
@ -211,11 +212,7 @@ func buildLinker(workingDir string, overlay map[string]string, outputLinkPath st
} }
func PatchLinker(goRoot, goVersion, cacheDir, tempDir string) (string, func(), error) { func PatchLinker(goRoot, goVersion, cacheDir, tempDir string) (string, func(), error) {
// rxVersion looks for a version like "go1.19" or "go1.20" patchesVer, modFiles, patches, err := loadLinkerPatches(version.Lang(goVersion))
rxVersion := regexp.MustCompile(`go\d+\.\d+`)
majorGoVersion := rxVersion.FindString(goVersion)
patchesVer, modFiles, patches, err := loadLinkerPatches(majorGoVersion)
if err != nil { if err != nil {
return "", nil, fmt.Errorf("cannot retrieve linker patches: %v", err) return "", nil, fmt.Errorf("cannot retrieve linker patches: %v", err)
} }

Loading…
Cancel
Save