parent
e2acf6511e
commit
86873b296c
|
@ -0,0 +1,11 @@
|
|||
all:
|
||||
@echo
|
||||
@echo Run: make redomod
|
||||
@echo
|
||||
@# ./myrepos >/tmp/myrepos.stderr 2>&1
|
||||
|
||||
redomod:
|
||||
rm -f go.*
|
||||
GO111MODULE= go mod init
|
||||
GO111MODULE= go mod tidy
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
module go.wit.com/gui/gadgets/repostatus
|
||||
|
||||
go 1.21.4
|
||||
|
||||
require (
|
||||
go.wit.com/gui/gadgets v0.10.3
|
||||
go.wit.com/gui/gui v0.12.3
|
||||
go.wit.com/log v0.5.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/alexflint/go-scalar v1.2.0 // indirect
|
||||
go.wit.com/arg v1.4.4 // indirect
|
||||
go.wit.com/gui/widget v0.0.0-20240105185907-84aafa536a93 // indirect
|
||||
go.wit.com/spew v0.0.0-20240101141411-c7b8e91573c9 // indirect
|
||||
)
|
|
@ -0,0 +1,23 @@
|
|||
github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+WQBRw=
|
||||
github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
go.wit.com/arg v1.4.4 h1:nfW8JUsVfyXi5l3BlTq5GGhesLlnyh3ICIm8cpM2U8w=
|
||||
go.wit.com/arg v1.4.4/go.mod h1:P2JoYIsJ9SSvp45qSnYibQEQPNTuTB8dTkyT9y1btsI=
|
||||
go.wit.com/gui/gadgets v0.10.3 h1:sL1GULM8Aedch3kSBdm4XuYMz/TfJ+pPeha/927/pGU=
|
||||
go.wit.com/gui/gadgets v0.10.3/go.mod h1:9bgxU4rUi4NQaZCgvuLvo6BwHsCx35kNyDalztYNT3A=
|
||||
go.wit.com/gui/gui v0.12.3 h1:0hmW5nlfvp+XRYfc59XZG/pSe/89+tMJo12h95XH98M=
|
||||
go.wit.com/gui/gui v0.12.3/go.mod h1:WrAJB4kIR/U0z/PzrkYYQG6QeuXDLcpgiH5vXnz5I1s=
|
||||
go.wit.com/gui/widget v0.0.0-20240105185907-84aafa536a93 h1:zCzaHvXJJ/rWXmDc/v79VvM6W2lxxzJGfnW2lHCv3Ho=
|
||||
go.wit.com/gui/widget v0.0.0-20240105185907-84aafa536a93/go.mod h1:A6/FaiFQtAHTjgo7c4FrokXe6bXX1Cowo35b2Lgi31E=
|
||||
go.wit.com/log v0.5.1 h1:D1Gdpo+EIOZDnBmW2SJCmqSD30ZWTGZ++NXyXeyMd2Y=
|
||||
go.wit.com/log v0.5.1/go.mod h1:0oxmE+WavwUZspnVAcOuIjS3vx7qVOFXj3vmUqKlzTE=
|
||||
go.wit.com/spew v0.0.0-20240101141411-c7b8e91573c9 h1:UEX2EzLQPzLTfy/kUFQD7OXtvKn8wk/+jpDOkbl4ff4=
|
||||
go.wit.com/spew v0.0.0-20240101141411-c7b8e91573c9/go.mod h1:qBpgJXThMMT15vym7/E4Ur9y8oOo2nP7t2RP52QHUNw=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
39
unix.go
39
unix.go
|
@ -4,9 +4,11 @@ package repostatus
|
|||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"strings"
|
||||
"regexp"
|
||||
"errors"
|
||||
"path/filepath"
|
||||
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
@ -147,3 +149,40 @@ func runCmd(path string, parts []string) (error, bool, string) {
|
|||
// Print the output
|
||||
return nil, true, tmp
|
||||
}
|
||||
|
||||
// Set the path to the package
|
||||
// Replace this with the actual path to the github.com/coredns/coredns directory
|
||||
func getfiles(pathToPackage string) {
|
||||
// List files in the directory
|
||||
err := filepath.Walk(pathToPackage, nil) // compiles but crashes
|
||||
if err == nil {
|
||||
log.Warn("directory ok", pathToPackage)
|
||||
} else {
|
||||
log.Warn("directory wrong", pathToPackage)
|
||||
}
|
||||
}
|
||||
|
||||
func IsDirectory(path string) bool {
|
||||
info, err := os.Stat(path)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return info.IsDir()
|
||||
}
|
||||
|
||||
|
||||
|
||||
func VerifyLocalGoRepo(gorepo string) bool {
|
||||
// Get current user
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
log.Error(err, "VerifyLocalGoRepo() thinks you should switch to Ultrix")
|
||||
return false
|
||||
}
|
||||
|
||||
// Form the path to the home Git directory
|
||||
gitDir := filepath.Join(usr.HomeDir, "go/src/", gorepo, ".git")
|
||||
|
||||
log.Warn("go directory:", gitDir)
|
||||
return IsDirectory(gitDir)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue