ctxrootcache

package
v0.342.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadRoot

func LoadRoot(ctx context.Context, path string) (string, bool, error)

LoadRoot loads the modulePath that the provided path will lead to.

func PrimaryRoot added in v0.340.0

func PrimaryRoot(ctx context.Context, compute func() string) string

PrimaryRoot returns the primary module root for ctx, computing it via compute() on the first call and reusing that result (even "not found", i.e. computed == "") for every later call, regardless of what compute would return this time. If ctx has no primary root cache (WithPrimaryRootCache was never called), compute() runs every time.

func StoreRoot

func StoreRoot(ctx context.Context, path, modulePath string) error

StoreRoot stores the path that leads to the modulePath to the map.

func WithPrimaryRootCache added in v0.340.0

func WithPrimaryRootCache(ctx context.Context) context.Context

WithPrimaryRootCache adds an empty, not-yet-resolved primary module root to the context.

func WithRootCache

func WithRootCache(ctx context.Context) context.Context

WithRootCache adds a module root cache in the context. This is meant to avoid global sync.Map which breaks with parallelized tests.

Types

This section is empty.

Jump to

Keyboard shortcuts

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