Documentation
¶
Index ¶
- func CopyTree(src string, dst string) error
- func PinLocalReplace(dir string, repoRoot string) error
- func RepoRoot() string
- func RequireTreeMatches(t testing.TB, wantDir string, gotDir string)
- func RunCmd(dir string, name string, args ...string) (string, error)
- func ServicePackageShadowNames(t testing.TB, dir, genpkg, marker string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PinLocalReplace ¶
PinLocalReplace rewrites the copied fixture go.mod to point the github.com/CaliLuke/loom replace directive at repoRoot.
func RepoRoot ¶
func RepoRoot() string
RepoRoot returns the absolute repository root for the current checkout.
func RequireTreeMatches ¶ added in v1.2.1
RequireTreeMatches asserts that gotDir contains exactly the same regular files as wantDir and that each file has identical contents.
func ServicePackageShadowNames ¶
ServicePackageShadowNames returns the identifiers that the generated Go files below dir declare where a service package imported under the same name would not compile, in the packages that import a service or views package, that is a package whose import path is genpkg/<name> or genpkg/<name>/views:
- the package-level declarations, which conflict with the import;
- the receivers, parameters, results and locals in scope where a service or views package is used, which would hide it;
- in the files that do not import a service or views package, the receivers, parameters, results and locals that are the operand of a selector, such as ws in ws.Close(): a generated file keeps an import when a selector of its name remains, so the file would keep the service package import and leave it unused.
It skips the service and views packages themselves. The result is sorted. It omits struct field names, names with upper case letters, which no generated package name has, and every name that contains marker, so that a test design can mark the names it gives to generated code.
Types ¶
This section is empty.