summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-14 14:30:45 -0600
committerJeff Carr <[email protected]>2024-12-14 14:30:45 -0600
commit5673e2cc2e82206cf4c864dd1b56538895fe6a6e (patch)
tree32321718066b1ce2e3910d52c341e23d0d7f27d7
parentb1d6923ca2b69b90e1edfe011a12f3fef5d1fa2e (diff)
fix go plugin build/installv0.0.29
-rw-r--r--build.go23
1 files changed, 18 insertions, 5 deletions
diff --git a/build.go b/build.go
index 327a19e..fc15d36 100644
--- a/build.go
+++ b/build.go
@@ -44,8 +44,11 @@ func (f *Forge) doBuild(repo *gitpb.Repo, userFlags []string, goWhat string) err
defer os.Unsetenv("GO111MODULE")
}
- if err := repo.ValidGoSum(); err != nil {
- return err
+ if f.IsGoWork() {
+ // there must be a valid go.mod file if compiling with go.work
+ if err := repo.ValidGoSum(); err != nil {
+ return err
+ }
}
if repo.Exists(".forge") {
@@ -77,17 +80,27 @@ func (f *Forge) doBuild(repo *gitpb.Repo, userFlags []string, goWhat string) err
if repo.CheckDirty() {
version = version + "-dirty"
}
+ cmd := []string{"go"}
if repo.RepoType() == "plugin" {
if goWhat == "install" {
- return errors.New("Can not go install plugins yet")
+ log.Info("Can not go install plugins yet. just building to ~/go/lib/")
}
+ cmd = append(cmd, "build")
+ } else {
+ cmd = append(cmd, goWhat)
}
- cmd := []string{"go", goWhat}
// if this is a plugin, use buildmode=plugin
if repo.RepoType() == "plugin" {
_, fname := filepath.Split(repo.FullPath)
- cmd = append(cmd, "-buildmode=plugin", "-o", fname+".so")
+ soname := fname + "." + version + ".so"
+ if goWhat == "install" {
+ homeDir, _ := os.UserHomeDir()
+ fullname := filepath.Join(homeDir, "go/lib", soname)
+ cmd = append(cmd, "-buildmode=plugin", "-o", fullname)
+ } else {
+ cmd = append(cmd, "-buildmode=plugin", "-o", soname)
+ }
}
cmd = append(cmd, "-v")