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

which

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package which implements the `which` built-in.

Resolution order:

  1. If the command is in the dispatch Registry, print /usr/bin/<name> (or whichever stub directory matches first in $PATH). This makes `which X` work for built-ins exactly like coreutils against /usr/bin entries.
  2. Otherwise walk $PATH (defaulting to "/usr/bin:/bin") and return the first executable found on the VFS.
  3. If nothing matches, exit 1 with no output.

Flags:

-a  print every match, not just the first
-s  silent: no output, just set the exit code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() command.Command

New returns the which command.

Types

This section is empty.

Jump to

Keyboard shortcuts

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