mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-11 18:54:31 +00:00
Updated scanner
Removed scanning all the import statements, this is not needed Added recursive scan for revel import path to pick up testunits
This commit is contained in:
@@ -174,8 +174,10 @@ func (c *CommandConfig) initAppFolder() (err error) {
|
||||
|
||||
// Use app folder to read the go.mod if it exists and extract the package information
|
||||
goModFile := filepath.Join(appFolder, "go.mod")
|
||||
utils.Logger.Info("Checking gomod, extracting from file", "path", goModFile,"exists", utils.Exists(goModFile))
|
||||
if utils.Exists(goModFile) {
|
||||
c.Vendored = true
|
||||
utils.Logger.Info("Found go mod, extracting from file", "path", goModFile)
|
||||
file, err := ioutil.ReadFile(goModFile)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -220,7 +222,7 @@ func (c *CommandConfig) initAppFolder() (err error) {
|
||||
c.AppPath = appFolder
|
||||
}
|
||||
|
||||
utils.Logger.Info("Set application path", "path", c.AppPath)
|
||||
utils.Logger.Info("Set application path", "path", c.AppPath, "vendored",c.Vendored, "importpath",c.ImportPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,6 @@ func (s *SourceInfo) TypesThatEmbed(targetType, packageFilter string) (filtered
|
||||
|
||||
// Look through the embedded types to see if the current type is among them.
|
||||
for _, embeddedType := range spec.EmbeddedTypes {
|
||||
|
||||
// If so, add this type's simple name to the nodeQueue, and its spec to
|
||||
// the filtered list.
|
||||
if typeSimpleName == embeddedType.String() {
|
||||
@@ -111,6 +110,7 @@ func (s *SourceInfo) TypesThatEmbed(targetType, packageFilter string) (filtered
|
||||
// ControllerSpecs returns the all the controllers that embeds
|
||||
// `revel.Controller`
|
||||
func (s *SourceInfo) ControllerSpecs() []*TypeInfo {
|
||||
utils.Logger.Infof("Scanning controller specifications for types ","typePath",RevelImportPath + ".Controller", "speclen",len(s.controllerSpecs))
|
||||
if s.controllerSpecs == nil {
|
||||
s.controllerSpecs = s.TypesThatEmbed(RevelImportPath + ".Controller", "controllers")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user