clone() and misc other fixes and improvements

This commit is contained in:
Jeff Carr 2024-12-15 08:48:06 -06:00
parent e796788e22
commit 340872788e
5 changed files with 7 additions and 8 deletions

View File

@ -15,12 +15,6 @@ vet:
goimports:
goimports -w *.go
redomod:
rm -f go.*
GO111MODULE= go mod init
GO111MODULE= go mod tidy
go mod edit -go=1.20
clean:
rm -f *.pb.go
-rm -f go.*

View File

@ -81,6 +81,7 @@ func (f *Forge) Clone(gopath string) (*gitpb.Repo, error) {
// try a direct git clone against the gopath
// cloneActual("helloworld", "/home/jcarr/go/src/go.wit.com/apps", "https://go.wit.com/apps/helloworld")
if finalurl, err := cloneActual(dirname, basedir, url); err == nil {
f.Repos.DeleteByGoPath(gopath)
// git clone worked!
return f.Repos.NewGoPath(f.goSrc, gopath, finalurl)
}
@ -94,6 +95,7 @@ func (f *Forge) Clone(gopath string) (*gitpb.Repo, error) {
log.Info("findGoImport() DID NOT WORK", err)
} else {
if finalurl, err := cloneActual(dirname, basedir, url); err == nil {
f.Repos.DeleteByGoPath(gopath)
// git clone worked!
return f.Repos.NewGoPath(f.goSrc, gopath, finalurl)
}
@ -106,6 +108,7 @@ func (f *Forge) Clone(gopath string) (*gitpb.Repo, error) {
log.Info("go list failed", err)
} else {
if finalurl, err := cloneActual(dirname, basedir, url); err == nil {
f.Repos.DeleteByGoPath(gopath)
// git clone worked!
return f.Repos.NewGoPath(f.goSrc, gopath, finalurl)
}
@ -115,6 +118,7 @@ func (f *Forge) Clone(gopath string) (*gitpb.Repo, error) {
// try to parse a redirect
if finalurl, err := clonePathHack(dirname, basedir, gopath); err == nil {
f.Repos.DeleteByGoPath(gopath)
// WTF didn't go-import or go list work?
return f.Repos.NewGoPath(f.goSrc, gopath, finalurl)
}

View File

@ -133,7 +133,7 @@ func (f *Forge) CheckoutMaster() bool {
}
func (f *Forge) CheckoutUser() bool {
log.Log(FORGEPBWARN, "running git checkout master everwhere")
log.Log(FORGEPBWARN, "running git checkout user everwhere")
var failed int = 0
var count int = 0
all := f.Repos.SortByGoPath()

View File

@ -65,6 +65,7 @@ func gitDirectoriesNew(srcDir string) ([]string, error) {
switch fname {
case "repos.pb":
case "go.work":
case "go.work.last":
default:
// todo: figure out a way to do padding for init()
log.Info("WARNING: you have an untracked file outside of any .git repository:", path)

View File

@ -23,7 +23,7 @@ func (f *Forge) MakeGoWork() error {
}
defer workf.Close()
fmt.Fprintln(workf, "go 1.20") // fix this
fmt.Fprintln(workf, "go 1.21") // fix this
fmt.Fprintln(workf, "")
fmt.Fprintln(workf, "use (")