clone() and misc other fixes and improvements
This commit is contained in:
parent
e796788e22
commit
340872788e
6
Makefile
6
Makefile
|
@ -15,12 +15,6 @@ vet:
|
||||||
goimports:
|
goimports:
|
||||||
goimports -w *.go
|
goimports -w *.go
|
||||||
|
|
||||||
redomod:
|
|
||||||
rm -f go.*
|
|
||||||
GO111MODULE= go mod init
|
|
||||||
GO111MODULE= go mod tidy
|
|
||||||
go mod edit -go=1.20
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.pb.go
|
rm -f *.pb.go
|
||||||
-rm -f go.*
|
-rm -f go.*
|
||||||
|
|
|
@ -81,6 +81,7 @@ func (f *Forge) Clone(gopath string) (*gitpb.Repo, error) {
|
||||||
// try a direct git clone against the gopath
|
// try a direct git clone against the gopath
|
||||||
// cloneActual("helloworld", "/home/jcarr/go/src/go.wit.com/apps", "https://go.wit.com/apps/helloworld")
|
// 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 {
|
if finalurl, err := cloneActual(dirname, basedir, url); err == nil {
|
||||||
|
f.Repos.DeleteByGoPath(gopath)
|
||||||
// git clone worked!
|
// git clone worked!
|
||||||
return f.Repos.NewGoPath(f.goSrc, gopath, finalurl)
|
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)
|
log.Info("findGoImport() DID NOT WORK", err)
|
||||||
} else {
|
} else {
|
||||||
if finalurl, err := cloneActual(dirname, basedir, url); err == nil {
|
if finalurl, err := cloneActual(dirname, basedir, url); err == nil {
|
||||||
|
f.Repos.DeleteByGoPath(gopath)
|
||||||
// git clone worked!
|
// git clone worked!
|
||||||
return f.Repos.NewGoPath(f.goSrc, gopath, finalurl)
|
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)
|
log.Info("go list failed", err)
|
||||||
} else {
|
} else {
|
||||||
if finalurl, err := cloneActual(dirname, basedir, url); err == nil {
|
if finalurl, err := cloneActual(dirname, basedir, url); err == nil {
|
||||||
|
f.Repos.DeleteByGoPath(gopath)
|
||||||
// git clone worked!
|
// git clone worked!
|
||||||
return f.Repos.NewGoPath(f.goSrc, gopath, finalurl)
|
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
|
// try to parse a redirect
|
||||||
|
|
||||||
if finalurl, err := clonePathHack(dirname, basedir, gopath); err == nil {
|
if finalurl, err := clonePathHack(dirname, basedir, gopath); err == nil {
|
||||||
|
f.Repos.DeleteByGoPath(gopath)
|
||||||
// WTF didn't go-import or go list work?
|
// WTF didn't go-import or go list work?
|
||||||
return f.Repos.NewGoPath(f.goSrc, gopath, finalurl)
|
return f.Repos.NewGoPath(f.goSrc, gopath, finalurl)
|
||||||
}
|
}
|
|
@ -133,7 +133,7 @@ func (f *Forge) CheckoutMaster() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Forge) CheckoutUser() 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 failed int = 0
|
||||||
var count int = 0
|
var count int = 0
|
||||||
all := f.Repos.SortByGoPath()
|
all := f.Repos.SortByGoPath()
|
||||||
|
|
|
@ -65,6 +65,7 @@ func gitDirectoriesNew(srcDir string) ([]string, error) {
|
||||||
switch fname {
|
switch fname {
|
||||||
case "repos.pb":
|
case "repos.pb":
|
||||||
case "go.work":
|
case "go.work":
|
||||||
|
case "go.work.last":
|
||||||
default:
|
default:
|
||||||
// todo: figure out a way to do padding for init()
|
// todo: figure out a way to do padding for init()
|
||||||
log.Info("WARNING: you have an untracked file outside of any .git repository:", path)
|
log.Info("WARNING: you have an untracked file outside of any .git repository:", path)
|
||||||
|
|
|
@ -23,7 +23,7 @@ func (f *Forge) MakeGoWork() error {
|
||||||
}
|
}
|
||||||
defer workf.Close()
|
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, "")
|
||||||
fmt.Fprintln(workf, "use (")
|
fmt.Fprintln(workf, "use (")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue