misc cleanups

This commit is contained in:
Jeff Carr 2024-03-09 16:49:27 -06:00
parent e6be71a33c
commit 77aa2ee639
4 changed files with 24 additions and 13 deletions

View File

@ -2,7 +2,15 @@ VERSION = $(shell git describe --tags)
run: build run: build
@#./go-clone --work github.com/rclone/rclone @#./go-clone --work github.com/rclone/rclone
./go-clone --work go.wit.com/apps/basicwindow @# ./go-clone --work go.wit.com/apps/basicwindow
./go-clone go.wit.com/apps/basicwindow
# test using --no-work against ~/go/src
homeGoSrc: build
./go-clone --no-work go.wit.com/apps/basicwindow
modernc: build
./go-clone --no-work modernc.org/sqlite
vet: vet:
@GO111MODULE=off go vet @GO111MODULE=off go vet

View File

@ -9,6 +9,7 @@ package main
type args struct { type args struct {
Repo string `arg:"positional" help:"go import path"` Repo string `arg:"positional" help:"go import path"`
Work bool `arg:"--work" help:"make a work directory"` Work bool `arg:"--work" help:"make a work directory"`
NoWork bool `arg:"--no-work" help:"does not make a go.work file"`
} }
func (a args) Description() string { func (a args) Description() string {

View File

@ -5,6 +5,6 @@ Maintainer: Jeff Carr <jcarr@wit.com>
Architecture: amd64 Architecture: amd64
Depends: Depends:
Recommends: go-clone Recommends: go-clone
Description: pulls down a go package and it's dependancies Description: git clones a go package and it's dependancies
does GO111MODULE=off go get -v (more or less) only works on git does GO111MODULE=auto go get -v (more or less) only works on git
repositories. repositories. This is an experiment. GO should be used instead.

20
main.go
View File

@ -36,7 +36,7 @@ func main() {
log.Info(err) log.Info(err)
os.Exit(-1) os.Exit(-1)
} }
log.Info("go.work directory:", wdir) log.Info("scanning directory:", wdir)
os.Setenv("REPO_WORK_PATH", wdir) os.Setenv("REPO_WORK_PATH", wdir)
// readControlFile() // readControlFile()
@ -62,18 +62,20 @@ func main() {
godep := newr.Status.GetGoDeps() godep := newr.Status.GetGoDeps()
for gopath, version := range godep { for gopath, version := range godep {
log.Info("git clone =", gopath, version) if _, err := rv.NewRepo(gopath); err != nil {
rv.NewRepo(gopath) log.Info("git clone failed for", gopath, version)
}
} }
for _, repo := range rv.AllRepos() { log.Info("all repositories are cloned")
log.Info("found repo", repo.GoPath(), repo.Status.Path()) if ! myargs.NoWork {
log.Info("Creating", wdir + "/go.work")
rv.MakeGoWork()
} }
rv.MakeGoWork()
// rv.Watchdog(func() { // for _, repo := range rv.AllRepos() {
// log.Info("watchdog") // log.Info("found repo", repo.GoPath(), repo.Status.Path())
// }) // }
} }
func clone(path string) { func clone(path string) {