const (
configChangeConfig = "config file"
configChangeGoMod = "go.mod file"
+ configChangeGoWork = "go work file"
)
func (c *commandeer) handleEvents(watcher *watcher.Batcher,
if strings.Contains(ev.Name, "go.mod") {
configChangeType = configChangeGoMod
}
+ if strings.Contains(ev.Name, ".work") {
+ configChangeType = configChangeGoWork
+ }
}
if !isConfig {
// It may be one of the /config folders
// Avoid recreating these later.
v1.Set("allModules", moduleConfig.ActiveModules)
+ // We want to watch these for changes and trigger rebuild on version
+ // changes etc.
if moduleConfig.GoModulesFilename != "" {
- // We want to watch this for changes and trigger rebuild on version
- // changes etc.
+
configFilenames = append(configFilenames, moduleConfig.GoModulesFilename)
}
+ if moduleConfig.GoWorkspaceFilename != "" {
+ configFilenames = append(configFilenames, moduleConfig.GoWorkspaceFilename)
+
+ }
+
return moduleConfig.ActiveModules, configFilenames, err
}
}
}*/
+ var workspaceFilename string
+ if h.ccfg.ModuleConfig.Workspace != WorkspaceDisabled {
+ workspaceFilename = h.ccfg.ModuleConfig.Workspace
+ }
+
return ModulesConfig{
- AllModules: c.modules,
- GoModulesFilename: c.GoModulesFilename,
+ AllModules: c.modules,
+ GoModulesFilename: c.GoModulesFilename,
+ GoWorkspaceFilename: workspaceFilename,
}, c
}
// Set if this is a Go modules enabled project.
GoModulesFilename string
+
+ // Set if a Go workspace file is configured.
+ GoWorkspaceFilename string
}
func (m *ModulesConfig) setActiveMods(logger loggers.Logger) error {
import (
"fmt"
+ "os"
"path/filepath"
"strings"
workingDir := cfg.GetString("workingDir")
c.Workspace = filepath.Join(workingDir, c.Workspace)
}
+ if _, err := os.Stat(c.Workspace); err != nil {
+ return c, fmt.Errorf("module workspace %q does not exist", c.Workspace)
+ }
}
}