@@ -12,7 +12,6 @@ import (
1212 "go/ast"
1313 "go/token"
1414 "go/scanner"
15-
1615)
1716
1817type (
@@ -111,9 +110,8 @@ func (s *SourceProcessor) addPackages() (err error) {
111110 s .packageList , err = packages .Load (config , allPackages ... )
112111 s .log .Info ("Loaded modules " , "len results" , len (s .packageList ), "error" , err )
113112
114-
115113 // Now process the files in the aap source folder s.revelContainer.ImportPath + "/...",
116- err = utils .Walk (s .revelContainer .AppPath , s .processPath )
114+ err = utils .Walk (s .revelContainer .BasePath , s .processPath )
117115 s .log .Info ("Loaded apps and modules " , "len results" , len (s .packageList ), "error" , err )
118116 return
119117}
@@ -136,8 +134,10 @@ func (s *SourceProcessor) processPath(path string, info os.FileInfo, err error)
136134 pkgImportPath := s .revelContainer .ImportPath
137135 appPath := s .revelContainer .BasePath
138136 if appPath != path {
139- pkgImportPath = s .revelContainer .ImportPath + "/" + filepath .ToSlash (path [len (appPath )+ 1 :])
137+ pkgImportPath = s .revelContainer .ImportPath + "/" + filepath .ToSlash (path [len (appPath ) + 1 :])
140138 }
139+ s .log .Info ("Processing source package folder" , "package" , pkgImportPath , "path" , path )
140+
141141 // Parse files within the path.
142142 var pkgMap map [string ]* ast.Package
143143 fset := token .NewFileSet ()
@@ -173,14 +173,15 @@ func (s *SourceProcessor) processPath(path string, info os.FileInfo, err error)
173173 ast .Print (nil , err )
174174 s .log .Fatal ("Failed to parse dir" , "error" , err )
175175 }
176+
176177 // Skip "main" packages.
177178 delete (pkgMap , "main" )
178179
179180 // Ignore packages that end with _test
180181 // These cannot be included in source code that is not generated specifically as a test
181182 for i := range pkgMap {
182183 if len (i ) > 6 {
183- if string (i [len (i )- 5 :]) == "_test" {
184+ if string (i [len (i ) - 5 :]) == "_test" {
184185 delete (pkgMap , i )
185186 }
186187 }
@@ -194,7 +195,7 @@ func (s *SourceProcessor) processPath(path string, info os.FileInfo, err error)
194195 // There should be only one package in this directory.
195196 if len (pkgMap ) > 1 {
196197 for i := range pkgMap {
197- println ("Found package " , i )
198+ println ("Found duplicate packages in single directory " , i )
198199 }
199200 utils .Logger .Fatal ("Most unexpected! Multiple packages in a single directory:" , "packages" , pkgMap )
200201 }
@@ -205,10 +206,10 @@ func (s *SourceProcessor) processPath(path string, info os.FileInfo, err error)
205206 p .Fset = fset
206207 for _ , pkg := range pkgMap {
207208 p .Name = pkg .Name
208- s .log .Info ("Found package" ,"pkg.Name" , pkg .Name ,"p.Name" , p .PkgPath )
209- for filename ,astFile := range pkg .Files {
210- p .Syntax = append (p .Syntax ,astFile )
211- p .GoFiles = append (p .GoFiles ,filename )
209+ s .log .Info ("Found package" , "pkg.Name" , pkg .Name , "p.Name" , p .PkgPath )
210+ for filename , astFile := range pkg .Files {
211+ p .Syntax = append (p .Syntax , astFile )
212+ p .GoFiles = append (p .GoFiles , filename )
212213 }
213214 }
214215 s .packageList = append (s .packageList , p )
0 commit comments