rootresolver

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rootresolver resolves the --root flag value to an fs.FS and a cleanup function.

Resolution order:

  1. Local filesystem path — returns os.DirFS(root), no-op cleanup.
  2. GitHub URL (github.com) + token provided — returns a github.FS that reads files directly via the GitHub Contents API. No local clone is needed; cleanup is a no-op.
  3. GitHub URL + no token (or API call fails) — falls back to git clone --depth 1 into a temp directory and returns os.DirFS of that directory. Cleanup removes the temp dir.

The token parameter should be populated by the caller (CLI layer). Passing an empty token triggers the clone fallback for GitHub URLs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resolve

func Resolve(ctx context.Context, root, token string) (fsys fs.FS, cleanup func(), err error)

Resolve returns an fs.FS for the given root and a cleanup function.

The caller must call cleanup() when the FS is no longer needed. For local paths and the GitHub API path cleanup is a no-op. For the clone fallback cleanup removes the temporary directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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