executable

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 2 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 executable answers what a platform means by "a program".

Two questions, and both have a POSIX answer this repository had inlined in five places: a program is a file with an execute bit, and it is stored under the name it is called by. Windows agrees with neither. It has no execute bit -- Go reports every regular file as 0666, so a permission test for one answers "not a program" about every program on the disk -- and it decides what it will run from the extension, which is also part of the file name a caller has to look for.

Neither difference is deep, which is exactly why it kept being written out by hand and getting it wrong was silent: the checks did not fail, they answered no.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseName

func BaseName(path string) string

BaseName returns the name a program is called by, given the path it is stored at. Here the two are the same.

The empty path is answered with the empty name rather than with what filepath.Base makes of it, which is ".". A comparison against "." would match a program called that and nothing else, which is a worse answer than no answer.

func Candidates

func Candidates(base string) []string

Candidates are the file names this platform would try when looking for a program called base, in the order it would try them.

Here there is one, which is why the distinction between naming a program and finding one is invisible until it is not: Windows stores a program under one name and will run several, so a lookup that tried only Name would miss a perfectly good `.cmd`.

func IsProgram

func IsProgram(info fs.FileInfo) bool

IsProgram reports whether info describes a file this platform would run: a regular file that somebody has permission to execute.

func Name

func Name(base string) string

Name returns the file name a program is stored under, which here is the name it is called by.

Types

This section is empty.

Jump to

Keyboard shortcuts

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