github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/os/exec/lp_unix.go (about) 1 // Copyright 2010 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build unix 6 7 package exec 8 9 import ( 10 "github.com/shogo82148/std/errors" 11 ) 12 13 // ErrNotFoundは、パスの検索が実行可能なファイルを見つけられなかった場合のエラーです。 14 var ErrNotFound = errors.New("executable file not found in $PATH") 15 16 // LookPathは、PATH環境変数で指定されたディレクトリ内の実行可能なファイルを検索します。 17 // もしファイルがスラッシュを含んでいる場合、直接試みられ、 18 // PATHは参照されません。 19 // 成功すると、結果は絶対パスになります。 20 // 21 // Goの古いバージョンでは、LookPathは現在のディレクトリに対する相対パスを返すことができました。 22 // Go 1.19以降では、LookPathはそのパスとともに、[errors.Is](err, [ErrDot])を満たすエラーを返します。 23 // 詳細はパッケージのドキュメンテーションを参照してください。 24 func LookPath(file string) (string, error)