goconsts

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package goconsts reads string constants out of Go source so a test can check that every constant of a family is handled, without a hand-kept list that goes stale the same way the code under test would.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringsWithPrefix

func StringsWithPrefix(t testing.TB, dir, prefix string) []string

StringsWithPrefix parses the non-test Go files in dir and returns the values of every package-level constant whose name starts with prefix, sorted. Each matching constant must be a plain string literal; anything else (iota, expressions) fails the test so it is never skipped silently.

Types

This section is empty.

Jump to

Keyboard shortcuts

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