diff --git a/build.gradle.kts b/build.gradle.kts index d2a4dd82..319dd466 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,7 +25,7 @@ allprojects { apply(plugin = "java") group = "com.phodal.chapi" - version = "2.0.0-beta.7" + version = "2.0.0-beta.8" description = "Chapi is A common language meta information convertor, convert different languages to same meta-data model" diff --git a/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoAnalyserTest.kt b/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoAnalyserTest.kt index 0609b9d7..3918ecf0 100644 --- a/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoAnalyserTest.kt +++ b/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoAnalyserTest.kt @@ -42,19 +42,17 @@ func main() { @Test @Disabled fun analysisByDir() { - val dir = "/iam" + val dir = "/Users/phodal/test/iam" val codeContainer = GoAnalyser().analysisByDir(dir) - println(codeContainer) + // write to file + val json = Json.encodeToString(codeContainer) + File("iam.json").writeText(json) } } private fun GoAnalyser.analysisByDir(dir: String): List { - val codeContainers = mutableListOf() val files = File(dir).walkTopDown().filter { it.isFile && it.extension == "go" }.toList() - files.forEach { - println(it.absolutePath) - val codeContainer = analysis(it.readText(), it.name) - codeContainers.add(codeContainer) - } - return codeContainers + return files.map { + analysis(it.readText(), it.name) + }.toList() }