MCPcopy Index your code
hub / github.com/rogpeppe/go-internal

github.com/rogpeppe/go-internal @v1.15.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.15.0 ↗ · + Follow
556 symbols 1,761 edges 98 files 240 documented · 43% 344 cross-repo links updated 7d agov1.15.0 · 2026-05-28★ 98833 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

This repository factors out an opinionated selection of internal packages and functionality from the Go standard library. Currently this consists mostly of packages and testing code from within the Go tool implementation.

This repo is primarily maintained by long-time Go contributors who are also currently maintaining CUE (which is primarily written in Go and which relies upon several of the packages here).

Contributions are welcome, but please open an issue for discussion first.

Packages

Included are the following:

  • goproxytest: a GOPROXY implementation designed for test use.
  • gotooltest: Use the Go tool inside test scripts (see testscript below)
  • imports: list of known architectures and OSs, and support for reading import statements.
  • par: do work in parallel.
  • testenv: information on the current testing environment.
  • testscript: script-based testing based on txtar files
  • txtar: simple text-based file archives for testing.

Note that most users of txtar should use https://pkg.go.dev/golang.org/x/tools/txtar instead. Our package will be replaced by it once https://github.com/golang/go/issues/59264 is fixed.

testscript

The most popular package here is the testscript package: * Provides a shell-like test environment that is very nicely tuned for testing Go CLI commands. * Extracted from the core Go team's internal testscript package (cmd/go/internal/script), which is heavily used to test the go command. * Supports patterns for checking stderr/stdout, command pass/fail assertions, and so on. * Integrates well with go test, including coverage support. * Inputs and sample output files can use the simple txtar text archive format, also used by the Go playground. * Allows automatically updating golden files. * Built-in support for Go concepts like build tags. * Accompanied by a testscript command for running standalone scripts with files embedded in txtar format.

A nice introduction to using testscripts is this blog post series. Both testscript and txtar were originally created by Russ Cox.

Extension points exported contracts — how you extend this code

TestingM (Interface)
TestingM is implemented by *testing.M. It's defined as an interface to allow testscript to co-exist with other testing f [5 …
testscript/exe.go
T (Interface)
T holds all the methods of the *testing.T type that are used by testscript. [2 implementers]
testscript/testscript.go
File (Interface)
A File provides the minimal set of methods required to lock an open file. File implementations must be usable as map key
lockedfile/internal/filelock/filelock.go
TFailed (Interface)
Deprecated: this type is unused.
testscript/testscript.go

Core symbols most depended-on inside this repo

Fatalf
called by 193
testscript/testscript.go
Fatal
called by 61
testscript/testscript.go
Name
called by 30
lockedfile/internal/filelock/filelock.go
Check
called by 29
testscript/testscript.go
Logf
called by 29
testscript/testscript.go
String
called by 24
lockedfile/mutex.go
Stat
called by 23
lockedfile/internal/filelock/filelock.go
Close
called by 22
lockedfile/lockedfile.go

Shape

Function 348
Method 146
Struct 50
TypeAlias 8
Interface 4

Languages

Go100%

Modules by API surface

testscript/testscript.go62 symbols
testscript/cmd.go32 symbols
testscript/testscript_test.go31 symbols
internal/syscall/windows/zsyscall_windows.go26 symbols
cache/cache.go26 symbols
testenv/testenv.go21 symbols
internal/syscall/windows/syscall_windows.go14 symbols
goproxytest/proxy.go13 symbols
cmd/testscript/main.go13 symbols
module/forward.go12 symbols
imports/read.go12 symbols
txtar/archive.go11 symbols

For agents

$ claude mcp add go-internal \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page