diff --git a/chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt b/chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt index aa5ed424..592d920b 100644 --- a/chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt +++ b/chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt @@ -21,7 +21,8 @@ class GoFullIdentListener(var fileName: String) : GoAstListener() { } override fun enterImportSpec(ctx: GoParser.ImportSpecContext?) { - val sourceName = ctx!!.importPath().text + val originSource = ctx!!.importPath().text + val sourceName = originSource.replace("\"", "") val codeImport = CodeImport(Source = sourceName) if (ctx.DOT() != null) { diff --git a/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoFullIdentListenerTest.kt b/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoFullIdentListenerTest.kt index 71dfdd3a..3814d2a3 100644 --- a/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoFullIdentListenerTest.kt +++ b/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoFullIdentListenerTest.kt @@ -24,6 +24,6 @@ import "fmt" val codeFile = GoAnalyser().analysis(code, "") assertEquals(codeFile.Imports.size, 1) - assertEquals(codeFile.Imports[0].Source, "\"fmt\"") + assertEquals(codeFile.Imports[0].Source, "fmt") } }