still trying to perfect this. todo: make gitpb perfect

This commit is contained in:
Jeff Carr 2024-12-15 15:52:46 -06:00
parent e3608b784e
commit a31f675e12
Notes: Jeff Carr 2024-12-15 15:57:01 -06:00
// `autogen:go.mod`

module go.wit.com/lib/protobuf/forgepb

go 1.21

toolchain go1.23.4

require (
	github.com/destel/rill v0.6.0
	go.wit.com/lib/gui/shell v0.22.17
	go.wit.com/lib/protobuf/gitpb v0.0.31
	go.wit.com/lib/protobuf/zoopb v0.0.19
	go.wit.com/log v0.22.9
	google.golang.org/protobuf v1.35.2
)

require github.com/go-cmd/cmd v1.4.3 // indirect

// `autogen:go.sum`

github.com/destel/rill v0.6.0 h1:8MQRzS6k0akKmwNZFahKIhG1dkBeNxMoWKSfOxkaJNw=
github.com/destel/rill v0.6.0/go.mod h1:srKuXzvGqINUEGYR5b/iwvW+L9/S35RxVHWGYbXNoO4=
github.com/go-cmd/cmd v1.4.3 h1:6y3G+3UqPerXvPcXvj+5QNPHT02BUw7p6PsqRxLNA7Y=
github.com/go-cmd/cmd v1.4.3/go.mod h1:u3hxg/ry+D5kwh8WvUkHLAMe2zQCaXd00t35WfQaOFk=
github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg=
github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
go.wit.com/lib/gui/shell v0.22.17 h1:JfGozzkhrlCDCtQCVgVExobvseFc2ZIM9r76cXCouwg=
go.wit.com/lib/gui/shell v0.22.17/go.mod h1:zduuMSWq+EE7w0xbXn+vkoGZ4HJhURVJpvXw8oK9WAU=
go.wit.com/lib/protobuf/gitpb v0.0.31 h1:jnNGwnThZYLvRjZgLN+h5j5A99zoSD9dHd9UzgpEtUM=
go.wit.com/lib/protobuf/gitpb v0.0.31/go.mod h1:ufUa44/Y+0I5g+fX1nz995EEsKJ8apPpMtPTC3LXJu4=
go.wit.com/lib/protobuf/zoopb v0.0.19 h1:sC5l0gs20adoV/zws7VEYlPhmgB77TvyzSK2XY2r5NI=
go.wit.com/lib/protobuf/zoopb v0.0.19/go.mod h1:bdeHyuJI//suaWh97S0G2dBK46+e0gQk0u9nL3yfAcI=
go.wit.com/log v0.22.9 h1:aBM6SI2kxlJcBfS/osFTomJqNhO0hfEo1gk+LCqLk7Y=
go.wit.com/log v0.22.9/go.mod h1:4uNPFBqhsAh8zNF+zxVEmC3c/9AZ8JeTfUUvRpddvLQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=

// `autogen:`
2 changed files with 21 additions and 4 deletions

View File

@ -133,6 +133,20 @@ func (f *Forge) finishClone(gopath string, giturl string) (*gitpb.Repo, error) {
log.Warn("forge.Clone() url changed", newr.URL, "to", giturl)
newr.URL = giturl
}
if err := newr.RepoIgnoresGoMod(); err != nil {
log.Info("never modify go.mod or go.sum for this repo", newr.GoPath)
log.Info("We recommend you add 'go.*' to your .gitignore file and store those files as git tag metadata")
newr.ParseGoSum()
return newr, nil
}
if newr.Exists("go.mod") {
return newr, nil
}
log.Info("todo: something went wrong probably. didn't finish. run go-mod-clean? (can't here. loop of circles)")
log.Info("todo: do go mod init here directly")
log.Info("todo: try to run go mod init here", newr.GoPath)
return newr, nil
}

View File

@ -27,13 +27,16 @@ func (f *Forge) FinalGoDepsCheckOk(check *gitpb.Repo) bool {
return false
}
// clear out the protobuf and rescan from the file
check.GoDeps = nil
if ok, _ := check.IsPrimitive(); ok {
// IsPrimitive() is expected to set GoPrimitive = true in the protobuf
if err := check.SetPrimitive(); err == nil {
log.Info("gitpb.SetPrimitive() returned true for", check.GoPath)
return true
}
// clear out the protobuf and rescan from the file
check.GoDeps = nil
if ok, err := check.ParseGoSum(); !ok {
log.Info("FinalGoDepsCheckOk() error", err)
log.Info("forge.FinalGoDepsCheckOk() error", err)
return false
}