File tree Expand file tree Collapse file tree
chapi-ast-go/src/test/kotlin/chapi/ast/goast Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ allprojects {
2525 apply (plugin = " java" )
2626
2727 group = " com.phodal.chapi"
28- version = " 2.0.0-beta.7 "
28+ version = " 2.0.0-beta.8 "
2929 description =
3030 " Chapi is A common language meta information convertor, convert different languages to same meta-data model"
3131
Original file line number Diff line number Diff line change @@ -42,19 +42,17 @@ func main() {
4242 @Test
4343 @Disabled
4444 fun analysisByDir () {
45- val dir = " /iam"
45+ val dir = " /Users/phodal/test/ iam"
4646 val codeContainer = GoAnalyser ().analysisByDir(dir)
47- println (codeContainer)
47+ // write to file
48+ val json = Json .encodeToString(codeContainer)
49+ File (" iam.json" ).writeText(json)
4850 }
4951}
5052
5153private fun GoAnalyser.analysisByDir (dir : String ): List <CodeContainer > {
52- val codeContainers = mutableListOf<CodeContainer >()
5354 val files = File (dir).walkTopDown().filter { it.isFile && it.extension == " go" }.toList()
54- files.forEach {
55- println (it.absolutePath)
56- val codeContainer = analysis(it.readText(), it.name)
57- codeContainers.add(codeContainer)
58- }
59- return codeContainers
55+ return files.map {
56+ analysis(it.readText(), it.name)
57+ }.toList()
6058}
You can’t perform that action at this time.
0 commit comments