diff --git a/Makefile b/Makefile index 69f5f59..b61d14a 100644 --- a/Makefile +++ b/Makefile @@ -1,37 +1,7 @@ VERSION = $(shell git describe --tags) +BUILDTIME = $(shell date +%Y.%m.%d) -all: - @echo to test: 'make test' - @echo open test win: 'make tempWin' - @echo - @echo run this from the autotypist dir: - @echo " GUIRELEASE_REASON=notsure guireleaser" - @echo then: - @echo " make prepare-release" - @echo then: - @echo " make showNext" - @echo " make doRelease" - @echo loop until done - -# single: build -# ./guireleaser go.wit.com/apps/go-clone --increment --release --reason "testing guireleaser" --dry-run -# dump: -# ./guireleaser go.wit.com/apps/go-clone --increment --release --reason "testing guireleaser" --dry-run --dump-versions -# single-really-do-it: build -# ./guireleaser go.wit.com/apps/go-clone --increment --release --reason "testing guireleaser" - -stderr: build - echo "writing to /tmp/guireleaser.stderr" - ./guireleaser >/tmp/guireleaser.stderr 2>&1 - -prepare-release: - reset - make list-release-notdone - make curl-incrementAllTargetVersions - make list-release-notdone - make curl-whitelist-stuff - make findNext - make showNext +all: build goimports: goimports -w *.go @@ -45,14 +15,14 @@ build: echo "build it!" -rm resources/*.so cp -a ~/go/src/go.wit.com/toolkits/*.so resources/ - GO111MODULE=off go build -v -x -ldflags " \ - -X main.VERSION=${VERSION}" + GO111MODULE=off go build \ + -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" install: -rm resources/*.so cp -a ~/go/src/go.wit.com/toolkits/*.so resources/ - GO111MODULE=off go install -v -x -ldflags " \ - -X main.VERSION=${VERSION}" + GO111MODULE=off go install \ + -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" test: build GUIRELEASE_REASON='test build' ./guireleaser diff --git a/main.go b/main.go index 9580677..d4548b5 100644 --- a/main.go +++ b/main.go @@ -115,7 +115,9 @@ func main() { // find myself. the guireleaser directory is used as a working scratchpad // for running go commands that can mess up the go.* files - for _, repo := range me.repos.View.AllRepos() { + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() if repo.GoPath() == "go.wit.com/apps/guireleaser" { if me.release.guireleaser == nil { me.release.guireleaser = repo @@ -146,7 +148,9 @@ func main() { // to the master branch func setAllBranchesToMaster() bool { var worked bool = true - for _, repo := range me.repos.View.AllRepos() { + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() if repo.ReadOnly() { continue } diff --git a/releaseBox.go b/releaseBox.go index acdcb2b..8b93d19 100644 --- a/releaseBox.go +++ b/releaseBox.go @@ -143,7 +143,9 @@ func createReleaseBox(box *gui.Node) { // rather than loop forever, at least limit this to the number of repos // incase something, somewhere, goes wrong duration := repolist.TimeFunction(func() { - for n := 0; n <= len(me.repos.View.AllRepos()); n++ { + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + loop.Repo() if doRelease() { log.Info("doRelease() worked") } else { @@ -179,7 +181,9 @@ func createReleaseBox(box *gui.Node) { grid.NextRow() grid.NewButton("git ls-files |grep go.mod", func() { - for _, repo := range me.repos.View.AllRepos() { + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() log.Info("repo:", repo.Name()) if repo.Status.ReadOnly() { continue @@ -275,7 +279,9 @@ func setCurrentRepo(newcur *repolist.RepoRow, s string, note string) bool { // todo: redo this logic as it is terrible // rename this findNext() func findNext() bool { - for _, repo := range me.repos.View.AllRepos() { + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() if repo.Status.IsReleased() { continue } diff --git a/setTargetVersion.go b/setTargetVersion.go index 017649f..24388a6 100644 --- a/setTargetVersion.go +++ b/setTargetVersion.go @@ -17,9 +17,11 @@ func setTargetVersion() { // we could rename go.wit.com/widget to go.wit.com/newwidget and restart the versioning // system, but that's rediculous and this servers to always remind me to never make this mistake again var count int - for i, repo := range me.repos.View.AllRepos() { + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() if repo == nil { - log.Info("initial scan repo = nil", i) + log.Info("initial scan repo = nil") continue } @@ -52,7 +54,9 @@ func setTargetVersion() { // trys to figure out if the version needs to be incremented func incrementTargetVersion() bool { var count int - for _, repo := range me.repos.View.AllRepos() { + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() if repo.ReadOnly() { continue }