Restructured command config

Removed go/build reference in clean
This commit is contained in:
notzippy@gmail.com
2020-04-26 11:07:06 -07:00
parent c1aee24445
commit 07d67846c1
10 changed files with 80 additions and 45 deletions

View File

@@ -8,7 +8,7 @@ import (
"fmt"
"github.com/revel/cmd/model"
"github.com/revel/cmd/utils"
"go/build"
"os"
"path/filepath"
)
@@ -50,14 +50,10 @@ func updateCleanConfig(c *model.CommandConfig, args []string) bool {
// Clean the source directory of generated files
func cleanApp(c *model.CommandConfig) (err error) {
appPkg, err := build.Import(c.ImportPath, "", build.FindOnly)
if err != nil {
utils.Logger.Fatal("Abort: Failed to find import path:", "error", err)
}
purgeDirs := []string{
filepath.Join(appPkg.Dir, "app", "tmp"),
filepath.Join(appPkg.Dir, "app", "routes"),
filepath.Join(c.AppPath, "app", "tmp"),
filepath.Join(c.AppPath, "app", "routes"),
}
for _, dir := range purgeDirs {