Documentation
¶
Index ¶
- Variables
- func CacheDirPath() string
- func Download(url string) (io.ReadCloser, error)
- func Exec(binPath string) error
- func OpenFileInArchive(archiveFile *os.File, archiveFileSize int64, archiveFormat ArchiveFormat, ...) (io.ReadCloser, error)
- func SelectByLibc(glibc, other string) string
- type ArchiveFormat
- type Artifact
- type Checksum
- type ReadCloserWrapper
- type Tool
Constants ¶
This section is empty.
Variables ¶
View Source
var IsGlibcEnv = sync.OnceValue( func() bool { if out, err := os.ReadFile("/proc/self/maps"); err == nil { if muslRegex.Match(out) { return false } } if lddPath, err := exec.LookPath("ldd"); err == nil { if ldd, err := os.ReadFile(lddPath); err == nil { if muslRegex.Match(ldd) { return false } else if glibcRegex.Match(ldd) { return true } } if lddVersion, err := exec.Command( lddPath, "--version", ).CombinedOutput(); err == nil { if muslRegex.Match(lddVersion) { return false } else if glibcRegex.Match(lddVersion) { return true } } } return false }, )
IsGlibcEnv returns true if the host platform is a GNU libc environment. Otherwise, e.g. on musl libc environments, returns false.
Functions ¶
func CacheDirPath ¶ added in v0.0.2
func CacheDirPath() string
func OpenFileInArchive ¶ added in v0.0.2
func OpenFileInArchive( archiveFile *os.File, archiveFileSize int64, archiveFormat ArchiveFormat, inArchiveFilePath string, ) (io.ReadCloser, error)
func SelectByLibc ¶ added in v0.0.2
SelectByLibc returns [glibc] if glibc was detected, otherwise returns [other] on e.g. musl libc environments. If glibc was not explicitly detected it will default to [other].
Types ¶
type ArchiveFormat ¶ added in v0.0.2
type ArchiveFormat int
const ( NotAnArchive ArchiveFormat = iota ZipArchive TarArchive TarGzipArchive TarBzip2Archive )
type Artifact ¶ added in v0.0.2
type Artifact struct {
CacheName string
DownloadURL string
Checksum Checksum
ArchiveFormat ArchiveFormat
InArchiveFilePath string
}
Artifact defines where and how to download the artifact for a tool.
type ReadCloserWrapper ¶ added in v0.0.2
ReadCloserWrapper is an io.ReadCloser which wraps an io.Reader with an optionally definable io.Closer.
func (*ReadCloserWrapper) Close ¶ added in v0.0.2
func (r *ReadCloserWrapper) Close() error
type Tool ¶ added in v0.0.2
Tool defines a gotoolbox tool.
func (*Tool) DownloadIfNeeded ¶ added in v0.0.2
TODO: Compare with dprint and goreleaser npm install.js scripts.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.