summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-03-09 16:49:27 -0600
committerJeff Carr <[email protected]>2024-03-09 16:49:27 -0600
commit77aa2ee639644b2ad14618c2a67f05d45ad5708c (patch)
tree324c7b0ec94114bc4bd95eed59ef748721c4e193
parente6be71a33caf7dba9d4060231bd34586aeb41fe2 (diff)
misc cleanupsv0.0.3
-rw-r--r--Makefile10
-rw-r--r--argv.go1
-rw-r--r--control6
-rw-r--r--main.go20
4 files changed, 24 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 001d032..e68ae43 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,15 @@ VERSION = $(shell git describe --tags)
run: build
@#./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:
@GO111MODULE=off go vet
diff --git a/argv.go b/argv.go
index 97940cb..4a8cbf9 100644
--- a/argv.go
+++ b/argv.go
@@ -9,6 +9,7 @@ package main
type args struct {
Repo string `arg:"positional" help:"go import path"`
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 {
diff --git a/control b/control
index 930188f..691820d 100644
--- a/control
+++ b/control
@@ -5,6 +5,6 @@ Maintainer: Jeff Carr <[email protected]>
Architecture: amd64
Depends:
Recommends: go-clone
-Description: pulls down a go package and it's dependancies
- does GO111MODULE=off go get -v (more or less) only works on git
- repositories.
+Description: git clones a go package and it's dependancies
+ does GO111MODULE=auto go get -v (more or less) only works on git
+ repositories. This is an experiment. GO should be used instead.
diff --git a/main.go b/main.go
index fb1f6b6..dffa258 100644
--- a/main.go
+++ b/main.go
@@ -36,7 +36,7 @@ func main() {
log.Info(err)
os.Exit(-1)
}
- log.Info("go.work directory:", wdir)
+ log.Info("scanning directory:", wdir)
os.Setenv("REPO_WORK_PATH", wdir)
// readControlFile()
@@ -62,18 +62,20 @@ func main() {
godep := newr.Status.GetGoDeps()
for gopath, version := range godep {
- log.Info("git clone =", gopath, version)
- rv.NewRepo(gopath)
+ if _, err := rv.NewRepo(gopath); err != nil {
+ log.Info("git clone failed for", gopath, version)
+ }
}
- for _, repo := range rv.AllRepos() {
- log.Info("found repo", repo.GoPath(), repo.Status.Path())
+ log.Info("all repositories are cloned")
+ if ! myargs.NoWork {
+ log.Info("Creating", wdir + "/go.work")
+ rv.MakeGoWork()
}
- rv.MakeGoWork()
- // rv.Watchdog(func() {
- // log.Info("watchdog")
- // })
+// for _, repo := range rv.AllRepos() {
+// log.Info("found repo", repo.GoPath(), repo.Status.Path())
+// }
}
func clone(path string) {