Help us shape the future of Go! Take the 2026 Go Developer Survey

actionfixture

package
v3.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package actionfixture holds the fixture packages the suites of cmd/internal/actionrequests and cmd/audit_readonly_graphql both load: Go source written as strings, put into the loader's overlay under Dir, a directory that exists nowhere on disk, and type-checked against the real toolutil and client-go so a resolver is held to the shapes it meets in the tree rather than to a mock of them.

It is a package of its own because both suites need the same packages: the resolver's tests hold the walk to them, and the audit's tests hold what the audit makes of the walk to them. Two copies would drift, and a fixture that drifted in one suite tests a shape the other no longer has.

Nothing here is linked into a binary: every reader is a test.

Index

Constants

View Source
const Backtick = "@@"

Backtick stands in for a backtick inside a fixture source, which is itself written as a raw string literal and so cannot contain one.

View Source
const Dir = "cmd/internal/actionrequests/fixture"

Dir is the directory the fixture packages pretend to live in, relative to the module root. Nothing is written there: the packages exist only in the loader overlay, which keeps generated Go source out of the repository.

View Source
const Edge = `` /* 2033-byte string literal not displayed */

Edge writes the shapes the inventory's rule and the readonly audit's own rule used to judge differently, in both directions, with the handlers and specs that make the gate answer for them end to end.

headedMutation carries its operation under a header line, so the document does not open the string it is written in. spacelessRead is a one-field selection set written without a space, which is also how a UCUM unit annotation is written. The inventory refused both, the audit's own rule read both, and a mutation written either way was therefore judged by nothing while the gate went on printing a clean run. secondLine is the other direction: a document the inventory read and the audit's rule did not, which cost a finding rather than a silence.

View Source
const Other = `` /* 1637-byte string literal not displayed */

Other holds the pieces a spec can reach across a package boundary: a handler named through a selector, and a route held in a package-level variable, which the resolver deliberately does not follow.

It also declares an action called "quiet", which is the name Shapes gives its REST-only action, routed here to a handler that sends a mutation. Two packages declaring one action name is what makes the owning package's part in resolution observable: the catalog says which of them declares the action it is asking about, and taking the other one would report a mutation against an action whose handler touches no GraphQL at all.

View Source
const Pattern = "./cmd/internal/actionrequests/fixture/..."

Pattern matches every fixture package at once. It is spelled out rather than built from Dir, and a test holds the two to each other.

View Source
const Requests = `` /* 6432-byte string literal not displayed */

Requests writes the shapes the walk from a handler to what it reaches had to learn, each the way a domain of this tree writes it:

  • a test seam holding a function literal (the group boards' newRawRequest), a method expression (commits' newRequest) and a dispatch table of literals (the integrations' getters), all package-level variables a handler reaches only by naming them;
  • a route helper that wraps the delete it is handed in a literal of its own (awardEmojiDeleteRoute), called twice with two deletes;
  • two lists declaring one set of action names, told apart only by the individual tool name each one's options declare (the badge twins), through a helper that amends the options, a field assignment of the whole tool spec, and a field assignment of its name over a literal that wrote another.
View Source
const Shapes = `` /* 8090-byte string literal not displayed */

Shapes declares one action per spelling an ActionSpec is written in across this repository, each routed to its own handler, so the resolver is held to following the forwarding rather than to recognizing one shape.

The closure action exists because a route may be built from a function literal, which has no declared function to use as a call-graph root; its body reaches the mutation, so a resolver that dropped literals would report nothing for it.

View Source
const Unplaced = `` /* 128-byte string literal not displayed */

Unplaced writes a document in the one shape no walk can place: assembled where it is used, in a package-level initializer, so it is bound to no object and sits in no function body. It is a package of its own because it fails every readonly audit run that loads it, which is the point.

View Source
const Vars = `` /* 223-byte string literal not displayed */

Vars declares GraphQL documents as package-level variables rather than constants, plus the two variable shapes that carry no knowable value.

View Source
const Vuln = `` /* 3015-byte string literal not displayed */

Vuln is one package holding a read document and a mutation document, handlers for each, a handler that reaches the mutation only through a callee, and action specs that classify some of them honestly and one of them wrongly.

It is written the way a real domain is written, including the package-local spec helper that forwards to toolutil, because the resolver's whole job is to follow that forwarding.

Variables

View Source
var ErrNoModule = errors.New("no go.mod above the directory")

ErrNoModule is a start directory with no go.mod at or above it.

Functions

func Main

func Main() map[string]string

Main is the fixture set the resolution and detection tests load: the construction shapes, the vulnerability-style handlers, the variable documents, and the second package that shares an action name with the first.

func Overlay

func Overlay(root string, sources map[string]string) map[string][]byte

Overlay turns a map of package name to source into a loader overlay rooted at root: each entry becomes one file in its own package directory under Dir, with every Backtick made a backtick.

func Root

func Root(start string) (string, error)

Root walks up from start, a test's working directory, to the module root, so an overlay can name absolute paths inside the module and the loader resolves the module's own import paths.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL