aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2018-09-14 22:06:11 +0700
committerShulhan <ms@kilabit.info>2018-09-14 22:06:11 +0700
commitf7b8d4e829f1c47ab9156637c535e83af9c5ffee (patch)
treea58984520e0a45c5c44b564acd66516a0f804cfc
parentf17dc76fabfde51781f331606a05ea5e09aae717 (diff)
downloadbeku-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.go4
-rw-r--r--package.go4
-rw-r--r--package_test.go2
3 files changed, 5 insertions, 5 deletions
diff --git a/env.go b/env.go
index 6e8a14d..adcaa68 100644
--- a/env.go
+++ b/env.go
@@ -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
diff --git a/package.go b/package.go
index 51c656d..bd6f2d5 100644
--- a/package.go
+++ b/package.go
@@ -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()