Skip to content

Commit

Permalink
fix: fix crash issues for golang
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 25, 2022
1 parent e103097 commit 1c6a410
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
16 changes: 7 additions & 9 deletions chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoAnalyserTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<CodeContainer> {
val codeContainers = mutableListOf<CodeContainer>()
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()
}

0 comments on commit 1c6a410

Please sign in to comment.