[MM-63345] Address Go v1.23 incompatibility issues with plugins (#30386)
* Address Go v1.23 incompatibility issues with plugins * Install multiple Go versions for compatibility tests * Rename
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
661f7f6a83
Коммит
7c25de2cff
@@ -15,6 +15,18 @@ import (
|
||||
)
|
||||
|
||||
func CompileGo(t *testing.T, sourceCode, outputPath string) {
|
||||
compileGo(t, "go", sourceCode, outputPath)
|
||||
}
|
||||
|
||||
func CompileGoVersion(t *testing.T, goVersion, sourceCode, outputPath string) {
|
||||
var goBin string
|
||||
if goVersion != "" {
|
||||
goBin = os.Getenv("GOBIN")
|
||||
}
|
||||
compileGo(t, filepath.Join(goBin, "go"+goVersion), sourceCode, outputPath)
|
||||
}
|
||||
|
||||
func compileGo(t *testing.T, goBin, sourceCode, outputPath string) {
|
||||
dir, err := os.MkdirTemp(".", "")
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(dir)
|
||||
@@ -32,7 +44,7 @@ func CompileGo(t *testing.T, sourceCode, outputPath string) {
|
||||
serverPath := filepath.Dir(filepath.Dir(sourceFile))
|
||||
|
||||
out := &bytes.Buffer{}
|
||||
cmd := exec.Command("go", "build", "-o", outputPath, main)
|
||||
cmd := exec.Command(goBin, "build", "-o", outputPath, main)
|
||||
cmd.Dir = serverPath
|
||||
cmd.Stdout = out
|
||||
cmd.Stderr = out
|
||||
|
||||
Ссылка в новой задаче
Block a user