mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-23 15:31:26 +00:00
Initial commit to go mod
This commit is contained in:
committed by
notzippy@gmail.com
parent
d2014633af
commit
acb8fb631b
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/revel/cmd/harness"
|
||||
"github.com/revel/cmd/model"
|
||||
"github.com/revel/cmd/utils"
|
||||
"go/build"
|
||||
)
|
||||
|
||||
var cmdBuild = &Command{
|
||||
@@ -153,10 +152,10 @@ func buildCopyModules(c *model.CommandConfig, revel_paths *model.RevelContainer,
|
||||
destPath := filepath.Join(c.Build.TargetPath, "src")
|
||||
// Find all the modules used and copy them over.
|
||||
config := revel_paths.Config.Raw()
|
||||
modulePaths := make(map[string]string) // import path => filesystem path
|
||||
|
||||
// We should only copy over the section of options what the build is targeted for
|
||||
// We will default to prod
|
||||
moduleImportList := []string{}
|
||||
for _, section := range config.Sections() {
|
||||
// If the runmode is defined we will only import modules defined for that run mode
|
||||
if c.Build.Mode != "" && c.Build.Mode != section {
|
||||
@@ -171,14 +170,15 @@ func buildCopyModules(c *model.CommandConfig, revel_paths *model.RevelContainer,
|
||||
if moduleImportPath == "" {
|
||||
continue
|
||||
}
|
||||
moduleImportList =append(moduleImportList,moduleImportPath)
|
||||
|
||||
modPkg, err := build.Import(moduleImportPath, revel_paths.RevelPath, build.FindOnly)
|
||||
if err != nil {
|
||||
utils.Logger.Fatalf("Failed to load module %s (%s): %s", key[len("module."):], c.ImportPath, err)
|
||||
}
|
||||
modulePaths[moduleImportPath] = modPkg.Dir
|
||||
}
|
||||
}
|
||||
modulePaths, err := utils.FindSrcPaths(c.AppPath, moduleImportList, c.PackageResolver)
|
||||
|
||||
if err != nil {
|
||||
utils.Logger.Fatalf("Failed to load modules ", "error", err)
|
||||
}
|
||||
|
||||
// Copy the the paths for each of the modules
|
||||
for importPath, fsPath := range modulePaths {
|
||||
|
||||
Reference in New Issue
Block a user