mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-11 18:54:31 +00:00
acept slash and inverted slash in src path validation
This commit is contained in:
@@ -2,9 +2,6 @@ package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/revel/cmd"
|
||||
"github.com/revel/cmd/logger"
|
||||
"github.com/revel/cmd/utils"
|
||||
"go/ast"
|
||||
"go/build"
|
||||
"go/parser"
|
||||
@@ -14,6 +11,10 @@ import (
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/revel/cmd"
|
||||
"github.com/revel/cmd/logger"
|
||||
"github.com/revel/cmd/utils"
|
||||
)
|
||||
|
||||
// The constants
|
||||
@@ -134,7 +135,7 @@ func (c *CommandConfig) UpdateImportPath() error {
|
||||
if strings.HasPrefix(currentPath, path) && len(currentPath) > len(path)+1 {
|
||||
importPath = currentPath[len(path)+1:]
|
||||
// Remove the source from the path if it is there
|
||||
if len(importPath) > 4 && strings.ToLower(importPath[0:4]) == "src/" {
|
||||
if len(importPath) > 4 && (strings.ToLower(importPath[0:4]) == "src/" || strings.ToLower(importPath[0:4]) == "src\\") {
|
||||
importPath = importPath[4:]
|
||||
} else if importPath == "src" {
|
||||
if c.Index != VERSION {
|
||||
@@ -219,7 +220,6 @@ func (c *CommandConfig) InitPackageResolver() {
|
||||
getCmd = exec.Command(depPath, "ensure", "-update", pkgName)
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
utils.Logger.Info("No vendor folder detected, not using dependency manager to import package", "package", pkgName)
|
||||
getCmd = exec.Command(c.GoCmd, "get", "-u", pkgName)
|
||||
|
||||
Reference in New Issue
Block a user