Source file src/internal/analysis/gotestchecker/export_test.go
1 // Copyright 2026 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 gotestchecker 6 7 // This file declares back doors for tests. 8 9 import ( 10 "go/analysis" 11 "go/types" 12 ) 13 14 // Analyzers returns the valid analyzers reachable from vars, in the 15 // canonical order that identifies them in the protocol. 16 func Analyzers(vars []Var) []*analysis.Analyzer { 17 return newGraph(vars).analyzers 18 } 19 20 // A FactSet is the set of facts visible to the analysis of a package. 21 type FactSet = factSet 22 23 // RegisterFactType registers a fact type for encoding. 24 func RegisterFactType(f analysis.Fact) { registerFactType(f) } 25 26 // DecodeFacts returns the set of facts for package pkg, decoding the 27 // facts of its direct imports, as returned by read. 28 func DecodeFacts(pkg *types.Package, getPackage func(pkgPath string) *types.Package, read func(pkgPath string) ([]byte, error)) (*FactSet, error) { 29 set, _, _, err := newFactDecoder(pkg, getPackage).Decode(read) 30 return set, err 31 } 32