testing go

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-29 09:31:22 -06:00
parent 856b479edb
commit 408a400e93
6 changed files with 77 additions and 40 deletions

58
deps.go Normal file
View File

@ -0,0 +1,58 @@
package repostatus
import (
"bufio"
"os"
"path/filepath"
"strings"
"go.wit.com/log"
)
func (rs *RepoStatus) GetGoDeps() GoConfig {
tmp := filepath.Join(rs.realPath.String(), "go.sum")
gosum, err := os.Open(tmp)
if err != nil {
log.Log(WARN, "\tmissing go.sum", rs.realPath.String())
return nil
}
defer gosum.Close()
var deps GoConfig
deps = make(GoConfig)
scanner := bufio.NewScanner(gosum)
log.Info("\tgosum:", tmp)
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
parts := strings.Split(line, " ")
if len(parts) == 3 {
godep := strings.TrimSpace(parts[0])
version := strings.TrimSpace(parts[1])
if strings.HasSuffix(version, "/go.mod") {
version = strings.TrimSuffix(version, "/go.mod")
}
currentversion, ok := deps[godep]
if ok {
if currentversion != version {
log.Info("\tREPO:", rs.String(), rs.realPath.String())
log.Info("\t version mismatch:", godep, version, currentversion)
return nil
}
} else {
deps[godep] = version
log.Info("\t", godep, "=", version)
}
} else {
log.Info("\t INVALID:", parts)
return nil
}
}
if err := scanner.Err(); err != nil {
return nil
}
return deps
}

View File

@ -273,6 +273,7 @@ func (rs *RepoStatus) drawGitCommands() {
}
var releaseRevision string = ""
// over ride the computation of this if a release is being created
func (rs *RepoStatus) setRevision(c string) {
if releaseRevision == "" {
@ -354,9 +355,17 @@ func (rs *RepoStatus) setTag() bool {
func (rs *RepoStatus) incrementVersion() {
lasttag := rs.lasttag.String()
var major, minor, revision string
if rs.targetReleaseVersion.String() == "" {
major, minor, revision = splitVersion(lasttag)
log.Warn("Should release version here", lasttag)
log.Log(INFO, "Should release a,b,c", major, minor, revision)
} else {
// this means there is a specific release version trying to be done
// use the target release version instead
major, minor, revision = splitVersion(rs.targetReleaseVersion.String())
log.Warn("Should release version here", lasttag)
log.Log(INFO, "Should release a,b,c", major, minor, revision)
}
a, _ := strconv.Atoi(major)
b, _ := strconv.Atoi(minor)

16
go.mod
View File

@ -1,16 +0,0 @@
module go.wit.com/lib/gui/repostatus
go 1.21.4
require (
go.wit.com/gui v0.13.18
go.wit.com/lib/gadgets v0.13.18
go.wit.com/log v0.13.18
go.wit.com/widget v1.1.9
)
require (
go.wit.com/dev/alexflint/arg v1.4.5 // indirect
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
go.wit.com/dev/davecgh/spew v1.1.4 // indirect
)

14
go.sum
View File

@ -1,14 +0,0 @@
go.wit.com/dev/alexflint/arg v1.4.5 h1:asDx5f9IlfpknKjPBqqb2qndE91Pbo7ZDkWUgddfMhY=
go.wit.com/dev/alexflint/arg v1.4.5/go.mod h1:wnWc+c6z8kSdDKYriMf6RpM+FiXmo5RYp/t4FNi0MU0=
go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26TvKNs=
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
go.wit.com/gui v0.13.18 h1:r4z1FNg6AxGWfq13+na4Xu/uA8PTTtDGka0ajo29omk=
go.wit.com/gui v0.13.18/go.mod h1:SRcfZKSbBWUxyyDiqlISWEYySoeATnijVxhzRIF0xiE=
go.wit.com/lib/gadgets v0.13.18 h1:Z35WCI6BtRamRkLTWaUP5/9+BnOGGbRdnD95SnnM6Tw=
go.wit.com/lib/gadgets v0.13.18/go.mod h1:hU0cXWfyvBrxmKD37MLyjOfJRK4+cU1aJ6lLx1CM0Qo=
go.wit.com/log v0.13.18 h1:XJNaQWX+8m12p3mH+kYih3zNjb0kScZDFpJa4c2TvKE=
go.wit.com/log v0.13.18/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
go.wit.com/widget v1.1.9 h1:iltjAL8UZu0YPfia8/qyfDx04BDxhj8rURcx0OHVBEc=
go.wit.com/widget v1.1.9/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=