generate go.work file for pkgsite

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-06 04:02:46 -06:00
parent 309cf80e16
commit 678d6357b1
3 changed files with 70 additions and 57 deletions

13
unix.go
View File

@ -212,6 +212,19 @@ func IsDirectory(path string) bool {
return info.IsDir()
}
func (rs *RepoStatus) Exists(filename string) bool {
usr, err := user.Current()
if err != nil {
log.Error(err, "Exists() error: could not determine what your username is")
return false
}
testf := filepath.Join(usr.HomeDir, "go/src/", rs.String(), filename)
if Exists(testf) {
return true
}
return false
}
// returns true if the file exists
func Exists(file string) bool {
_, err := os.Stat(file)