composite

package
v2.7.6 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package composite holds mutators that operate on composite literals (struct, map, and keyed array/slice literals).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MutatorFieldClear

func MutatorFieldClear(_ *types.Package, _ *types.Info, node ast.Node) []mutator.Mutation

MutatorFieldClear drops one keyed element from a composite literal, letting the field fall back to its zero value:

Config{Timeout: 30, Retries: 3}  →  Config{Retries: 3}
map[string]int{"a": 1, "b": 2}    →  map[string]int{"b": 2}

This targets fields that are set to a meaningful (non-zero) value but never asserted by any test — a pervasive shape in generated Go, where an options or config struct is populated in full yet only one or two fields actually matter to the test suite. One mutation is emitted per non-zero keyed element.

Elements whose value already looks like the zero value (0, "", false, nil) are skipped: dropping them produces an identical-behaviour mutant that would always survive and add noise rather than signal. Positional (unkeyed) elements are skipped too, since removing one shifts the remaining elements and changes meaning unpredictably.

Types

This section is empty.

Jump to

Keyboard shortcuts

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