diff --git a/cpg-language-go/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/GoExtraPass.kt b/cpg-language-go/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/GoExtraPass.kt index 7852ea822da..de72773b27c 100644 --- a/cpg-language-go/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/GoExtraPass.kt +++ b/cpg-language-go/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/GoExtraPass.kt @@ -115,8 +115,10 @@ class GoExtraPass(ctx: TranslationContext) : ComponentPass(ctx), ScopeProvider { get() = scopeManager.currentScope override fun accept(component: Component) { - // Add built-int functions - component.translationUnits += addBuiltIn() + // Add built-int functions, but only if one of the components contains a GoLanguage + if (component.translationUnits.any { it.language is GoLanguage }) { + component.translationUnits += addBuiltIn() + } val walker = SubgraphWalker.ScopedWalker(scopeManager) walker.registerHandler { _, parent, node ->