| 1 | // Copyright 2023 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package unitchecker |
| 6 | |
| 7 | import ( |
| 8 | "go/token" |
| 9 | "go/types" |
| 10 | ) |
| 11 | |
| 12 | // This file exposes various internal hooks to the separate_test. |
| 13 | // |
| 14 | // TODO(adonovan): expose a public API to unitchecker that doesn't |
| 15 | // rely on details of JSON .cfg files or enshrine I/O decisions or |
| 16 | // assumptions about how "go vet" locates things. Ideally the new Run |
| 17 | // function would accept an interface, and a Config file would be just |
| 18 | // one way--the go vet way--to implement it. |
| 19 | |
| 20 | func SetTypeImportExport( |
| 21 | MakeTypesImporter func(*Config, *token.FileSet) types.Importer, |
| 22 | ExportTypes func(*Config, *token.FileSet, *types.Package) error, |
| 23 | ) { |
| 24 | makeTypesImporter = MakeTypesImporter |
| 25 | exportTypes = ExportTypes |
| 26 | } |