diff --git a/llgo/irgen/compiler.go b/llgo/irgen/compiler.go index 413f31f23f18..36d35b78ce28 100644 --- a/llgo/irgen/compiler.go +++ b/llgo/irgen/compiler.go @@ -98,6 +98,10 @@ type CompilerOptions struct { // loader.Config, see the documentation for that package for more // information. PackageCreated func(*types.Package) + + // DisableUnusedImportCheck disables the unused import check performed + // by go/types if set to true. + DisableUnusedImportCheck bool } type Compiler struct { @@ -206,6 +210,7 @@ func (compiler *compiler) compile(fset *token.FileSet, astFiles []*ast.File, imp TypeChecker: types.Config{ Import: compiler.Importer, Sizes: compiler.llvmtypes, + DisableUnusedImportCheck: compiler.DisableUnusedImportCheck, }, Build: &buildctx.Context, PackageCreated: compiler.PackageCreated,