mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-11 18:54:31 +00:00
Initial commit to go mod
This commit is contained in:
committed by
notzippy@gmail.com
parent
d2014633af
commit
acb8fb631b
@@ -42,13 +42,14 @@ func addImports(imports map[string]string, decl ast.Decl, srcDir string) {
|
||||
// 2. Exempt the standard library; their directories always match the package name.
|
||||
// 3. Can use build.FindOnly and then use parser.ParseDir with mode PackageClauseOnly
|
||||
if pkgAlias == "" {
|
||||
|
||||
utils.Logger.Debug("Reading from build", "path", fullPath, "srcPath", srcDir, "gopath", build.Default.GOPATH)
|
||||
pkg, err := build.Import(fullPath, srcDir, 0)
|
||||
if err != nil {
|
||||
// We expect this to happen for apps using reverse routing (since we
|
||||
// have not yet generated the routes). Don't log that.
|
||||
if !strings.HasSuffix(fullPath, "/app/routes") {
|
||||
utils.Logger.Error("Could not find import:", "path", fullPath, "srcPath", srcDir, "error", err)
|
||||
utils.Logger.Warn("Could not find import:", "path", fullPath, "srcPath", srcDir, "error", err)
|
||||
}
|
||||
continue
|
||||
} else {
|
||||
|
||||
18
parser/utils.go
Normal file
18
parser/utils.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
//"golang.org/x/tools/go/packages"
|
||||
//"github.com/revel/cmd/utils"
|
||||
)
|
||||
//import "golang.org/x/tools/go/packages"
|
||||
//
|
||||
//func GetPackage(appPath, importPath string) {
|
||||
// config := &packages.Config{
|
||||
// Mode: packages.NeedName | packages.NeedFiles,
|
||||
// Dir:appPath,
|
||||
// }
|
||||
//
|
||||
// pkgs, err := packages.Load(config, []string{importPath})
|
||||
// utils.Logger.Info("Loaded packegs ", "len results", len(pkgs), "error",err)
|
||||
//
|
||||
//}
|
||||
Reference in New Issue
Block a user