fix build and cleanup old code
This commit is contained in:
parent
cc19c8ac8e
commit
c521620b04
|
@ -3,4 +3,4 @@ go.mod
|
||||||
go.sum
|
go.sum
|
||||||
/files/*
|
/files/*
|
||||||
/work/*
|
/work/*
|
||||||
go-clone
|
go-clone*
|
||||||
|
|
18
Makefile
18
Makefile
|
@ -1,14 +1,14 @@
|
||||||
VERSION = $(shell git describe --tags)
|
VERSION = $(shell git describe --tags)
|
||||||
BUILDTIME = $(shell date +%Y.%m.%d_%H%M)
|
BUILDTIME = $(shell date +%Y.%m.%d_%H%M)
|
||||||
|
|
||||||
run: build
|
run: install build-darwin build-darwin-arm64 build-windows
|
||||||
./go-clone --version
|
go-clone --version
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
@GO111MODULE=off go vet
|
@GO111MODULE=off go vet
|
||||||
@echo this go binary package builds okay
|
@echo this go binary package builds okay
|
||||||
|
|
||||||
no-gui: build
|
no-gui: install build-darwin build-windows
|
||||||
./go-clone --no-gui
|
./go-clone --no-gui
|
||||||
|
|
||||||
build: goimports
|
build: goimports
|
||||||
|
@ -16,11 +16,16 @@ build: goimports
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
|
||||||
build-darwin:
|
build-darwin:
|
||||||
GOOS=darwin GOARCH=amd64 GO111MODULE=off go build -v -o go-clone-darwin \
|
GOOS=darwin GOARCH=amd64 GO111MODULE=off go build -v -o go-clone-darwin.x86 \
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
|
||||||
|
build-darwin-arm64:
|
||||||
|
GOOS=darwin GOARCH=arm64 GO111MODULE=off go build -v -o go-clone-darwin.arm \
|
||||||
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
GOOS=windows GOARCH=amd64 GO111MODULE=off go build -v go-clone.exe \
|
GOOS=windows GOARCH=amd64 GO111MODULE=off go build -v -o go-clone.exe \
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=v0.7.46 -X main.BUILDTIME=2025.02.22_0643 -X gui.GUIVERSION=v0.7.46"
|
||||||
|
|
||||||
install: goimports
|
install: goimports
|
||||||
GO111MODULE=off go install \
|
GO111MODULE=off go install \
|
||||||
|
@ -45,6 +50,7 @@ nocui: build
|
||||||
./go-clone --gui nocui
|
./go-clone --gui nocui
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
rm -f go.*
|
||||||
-rm go-clone
|
-rm go-clone
|
||||||
|
|
||||||
# this will test the golang.org/x -> googlesource override
|
# this will test the golang.org/x -> googlesource override
|
||||||
|
|
17
argv.go
17
argv.go
|
@ -12,10 +12,9 @@ type args struct {
|
||||||
Repo string `arg:"positional" help:"go import path"`
|
Repo string `arg:"positional" help:"go import path"`
|
||||||
AutoWork bool `arg:"--work" default:"false" help:"recreate the go.work file"`
|
AutoWork bool `arg:"--work" default:"false" help:"recreate the go.work file"`
|
||||||
DryRun bool `arg:"--dry-run" help:"show what would be run"`
|
DryRun bool `arg:"--dry-run" help:"show what would be run"`
|
||||||
Recursive bool `arg:"--recursive" default:"false" help:"recursively clone all dependencies"`
|
Recursive bool `arg:"--recursive" default:"true" help:"recursively clone all dependencies"`
|
||||||
Pull bool `arg:"--git-pull" default:"false" help:"run 'git pull'"`
|
Build bool `arg:"--build" help:"try to build it after clone"`
|
||||||
Build bool `arg:"--build" default:"true" help:"try to build it after clone"`
|
Install bool `arg:"--install" help:"try to install it after clone"`
|
||||||
Install bool `arg:"--install" default:"false" help:"try to install it after clone"`
|
|
||||||
Ignore bool `arg:"--ignore" default:"false" help:"ignore weird clone errors from non-standard repos"`
|
Ignore bool `arg:"--ignore" default:"false" help:"ignore weird clone errors from non-standard repos"`
|
||||||
// Fetch bool `arg:"--git-fetch" default:"false" help:"run 'git fetch' on all your repos"`
|
// Fetch bool `arg:"--git-fetch" default:"false" help:"run 'git fetch' on all your repos"`
|
||||||
}
|
}
|
||||||
|
@ -26,15 +25,9 @@ func (args) Version() string {
|
||||||
|
|
||||||
func (a args) Description() string {
|
func (a args) Description() string {
|
||||||
return `
|
return `
|
||||||
git clone go repositories
|
git clone go repositories recursively
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
go-clone go.wit.com/apps/go-clone # simply try to git clone this
|
go-clone go.wit.com/apps/go-clone # 'git clone' go-clone
|
||||||
go-clone --recursive go.wit.com/apps/go-clone # recursively clone all the dependencies
|
|
||||||
go-clone --auto-work go.wit.com/apps/go-clone # if you are using a go.work file, recreate the go.work file
|
|
||||||
go-clone --go-reset # recreate every go.mod and go.sum file
|
|
||||||
go-clone --git-pull # run 'git pull' in every repo
|
|
||||||
go-clone --build # build every binary package
|
|
||||||
go-clone --install # install every binary package
|
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
30
gitPull.go
30
gitPull.go
|
@ -1,30 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go.wit.com/lib/gui/shell"
|
|
||||||
"go.wit.com/log"
|
|
||||||
)
|
|
||||||
|
|
||||||
func gitPull() {
|
|
||||||
log.Info("Total repositories:", forge.Repos.Len())
|
|
||||||
log.Info("Going to run git pull in each one. TODO: use rill here")
|
|
||||||
pull := []string{"git", "pull"}
|
|
||||||
|
|
||||||
var trycount, errcount int
|
|
||||||
repos := forge.Repos.SortByFullPath()
|
|
||||||
for repos.Scan() {
|
|
||||||
repo := repos.Next()
|
|
||||||
if argv.DryRun {
|
|
||||||
log.Info("git pull --dry-run", repo.GetGoPath())
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
log.Info("git pull:", repo.FullPath)
|
|
||||||
trycount += 1
|
|
||||||
log.Info("actually run: git pull:", repo.GetGoPath())
|
|
||||||
if result := shell.PathRunRealtime(repo.FullPath, pull); result.Error != nil {
|
|
||||||
log.Info("git pull error:", result.Error)
|
|
||||||
errcount += 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.Info("Total repositories:", forge.Repos.Len(), "Total attempted:", trycount, "Errors:", errcount)
|
|
||||||
}
|
|
Loading…
Reference in New Issue