mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
fix: failed to build debugtalk.go without go.mod
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"project_name": "demo-empty-project",
|
||||
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-empty-project",
|
||||
"create_time": "2022-05-29T13:24:31.960615+08:00",
|
||||
"project_path": "/Users/xxxxx/go/src/github.com/httprunner/httprunner/examples/demo-empty-project",
|
||||
"create_time": "2022-05-31T13:12:05.552655+08:00",
|
||||
"hrp_version": "v4.1.0"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"project_name": "demo-with-go-plugin",
|
||||
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-with-go-plugin",
|
||||
"create_time": "2022-05-29T13:24:29.431434+08:00",
|
||||
"project_path": "/Users/xxxxx/go/src/github.com/httprunner/httprunner/examples/demo-with-go-plugin",
|
||||
"create_time": "2022-05-31T13:12:04.150418+08:00",
|
||||
"hrp_version": "v4.1.0"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"project_name": "demo-with-py-plugin",
|
||||
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-with-py-plugin",
|
||||
"create_time": "2022-05-29T13:24:29.566414+08:00",
|
||||
"project_path": "/Users/xxxxx/go/src/github.com/httprunner/httprunner/examples/demo-with-py-plugin",
|
||||
"create_time": "2022-05-31T13:12:04.292557+08:00",
|
||||
"hrp_version": "v4.1.0"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"project_name": "demo-without-plugin",
|
||||
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-without-plugin",
|
||||
"create_time": "2022-05-29T13:24:31.840718+08:00",
|
||||
"project_path": "/Users/xxxxx/go/src/github.com/httprunner/httprunner/examples/demo-without-plugin",
|
||||
"create_time": "2022-05-31T13:12:05.424068+08:00",
|
||||
"hrp_version": "v4.1.0"
|
||||
}
|
||||
22
hrp/build.go
22
hrp/build.go
@@ -12,10 +12,10 @@ import (
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"github.com/httprunner/funplugin/shared"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/httprunner/funplugin/shared"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/version"
|
||||
)
|
||||
@@ -209,10 +209,22 @@ func buildGo(path string, output string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// download plugin dependency
|
||||
// funplugin version should be locked
|
||||
funplugin := fmt.Sprintf("github.com/httprunner/funplugin@%s", shared.Version)
|
||||
if err := builtin.ExecCommandInDir(exec.Command("go", "get", funplugin), pluginDir); err != nil {
|
||||
if !builtin.IsFilePathExists(filepath.Join(pluginDir, "go.mod")) {
|
||||
// create go mod
|
||||
if err := builtin.ExecCommandInDir(exec.Command("go", "mod", "init", "main"), pluginDir); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// download plugin dependency
|
||||
// funplugin version should be locked
|
||||
funplugin := fmt.Sprintf("github.com/httprunner/funplugin@%s", shared.Version)
|
||||
if err := builtin.ExecCommandInDir(exec.Command("go", "get", funplugin), pluginDir); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// add missing and remove unused modules
|
||||
if err := builtin.ExecCommandInDir(exec.Command("go", "mod", "tidy"), pluginDir); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user