diff options
| author | Shulhan <ms@kilabit.info> | 2018-09-14 22:06:11 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2018-09-14 22:06:11 +0700 |
| commit | f7b8d4e829f1c47ab9156637c535e83af9c5ffee (patch) | |
| tree | a58984520e0a45c5c44b564acd66516a0f804cfc | |
| parent | f17dc76fabfde51781f331606a05ea5e09aae717 (diff) | |
| download | beku-f7b8d4e829f1c47ab9156637c535e83af9c5ffee.tar.xz | |
package: simplify Go install method
Change the parameter from instance of env to string. The goal is to
decouple instance of environment from package.
| -rw-r--r-- | env.go | 4 | ||||
| -rw-r--r-- | package.go | 4 | ||||
| -rw-r--r-- | package_test.go | 2 |
3 files changed, 5 insertions, 5 deletions
@@ -1349,7 +1349,7 @@ func (env *Env) postSync(pkg *Package) (err error) { // (3) if len(pkg.DepsMissing) == 0 { - _ = pkg.GoInstall(env) + _ = pkg.GoInstall(env.path) } fmt.Println("[ENV] postSync >>> Package installed:\n", pkg) @@ -1384,7 +1384,7 @@ func (env *Env) reinstallAll() (err error) { } if len(pkg.DepsMissing) == 0 { - _ = pkg.GoInstall(env) + _ = pkg.GoInstall(env.path) } } return @@ -464,7 +464,7 @@ func (pkg *Package) load(sec *ini.Section) { // (1) Set PATH to let go install that require gcc work when invoked from // non-interactive shell (e.g. buildbot). // -func (pkg *Package) GoInstall(env *Env) (err error) { +func (pkg *Package) GoInstall(envPath string) (err error) { //nolint:gas cmd := exec.Command("go", "install") if debug.Value >= 2 { @@ -473,7 +473,7 @@ func (pkg *Package) GoInstall(env *Env) (err error) { cmd.Args = append(cmd.Args, "./...") cmd.Env = append(cmd.Env, "GOPATH="+build.Default.GOPATH) - cmd.Env = append(cmd.Env, "PATH="+env.path) + cmd.Env = append(cmd.Env, "PATH="+envPath) cmd.Dir = pkg.FullPath cmd.Stdout = defStdout cmd.Stderr = defStderr diff --git a/package_test.go b/package_test.go index 6bca340..8bda079 100644 --- a/package_test.go +++ b/package_test.go @@ -478,7 +478,7 @@ func testGoInstall(t *testing.T) { mock.Reset(true) - err := c.pkg.GoInstall(testEnv) + err := c.pkg.GoInstall(testEnv.path) mock.Reset(false) stdout := mock.Output() |
