Index: irgen/compiler.go
===================================================================
--- irgen/compiler.go
+++ irgen/compiler.go
@@ -98,6 +98,10 @@
 	// 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 @@
 		TypeChecker: types.Config{
 			Import: compiler.Importer,
 			Sizes:  compiler.llvmtypes,
+			DisableUnusedImportCheck: compiler.DisableUnusedImportCheck,
 		},
 		Build:          &buildctx.Context,
 		PackageCreated: compiler.PackageCreated,