stupid. really stupid. of course that code doesn't run in main()

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-07 10:56:04 -07:00
parent 2ba4c6e6ee
commit 4c9be65aba
4 changed files with 17 additions and 14 deletions

View File

@ -49,16 +49,9 @@ push:
tag-version:
# git push --delete origin v0.6.15 # to delete a tag upstream
-rm cloud-control-panel
go build
git tag v${VERSION}
git push --tags
cp .git/refs/tags/v${VERSION} resources/tags/
// scp resources/VERSION root@mirrors.wit.com:/data/mirrors/cloud/control-panel/linux/
// scp resources/BUILDDATE root@mirrors.wit.com:/data/mirrors/cloud/control-panel/linux/
// scp cloud-control-panel root@mirrors.wit.com:/data/mirrors/cloud/control-panel/linux/
// scp cloud-control-panel root@mirrors.wit.com:/data/mirrors/cloud/control-panel/linux/cloud-control-panel-v${VERSION}
// scp README root@mirrors.wit.com:/data/mirrors/cloud/control-panel/
# should update every go dependancy (?)
update:

View File

@ -5,6 +5,7 @@ package main
// upload binary to mirrors.wit.com/cloud/control-panel
import "log"
import "fmt"
import "time"
import "strings"
import "os/user"
@ -15,7 +16,6 @@ import "github.com/davecgh/go-spew/spew"
import "git.wit.com/wit/shell"
// import "fmt"
// import "os/user"
// import "io/ioutil"
// github.com/bramvdbogaerde/go-scp
@ -91,9 +91,16 @@ func build(tag string) *bool {
// os.Exit(-1)
// return nil
}
shell.Run("rm cloud-control-panel")
// setup the files that will end up in the binary
epoch := fmt.Sprintf("%d", time.Now().Unix())
shell.Write("./resources/BUILDDATE", epoch)
shell.Write("./resources/BUILDREF", gitref)
// rebuild the binary (always remove the old one
shell.Run("rm " + filename)
shell.Run("go build")
md5sum = shell.Run("md5sum cloud-control-panel")
md5sum = shell.Run("md5sum " + filename)
log.Println("\tmd5sum =", md5sum)
if (md5sum == "") {

10
main.go
View File

@ -95,11 +95,13 @@ func lookupAAAA(hostname string) string {
func main() {
go handleErrors()
epoch := fmt.Sprintf("%d", time.Now().Unix())
shell.Write("./resources/BUILDDATE", epoch)
// OMG I'm an idiot. of course this does't work
// it's easy to loose your mind trying to make this part of the code work
// epoch := fmt.Sprintf("%d", time.Now().Unix())
// shell.Write("./resources/BUILDDATE", epoch)
ref := shell.Run("git rev-list -1 HEAD")
shell.Write("./resources/BUILDREF", ref)
// ref := shell.Run("git rev-list -1 HEAD")
// shell.Write("./resources/BUILDREF", ref)
// for {}
// This puts all the files in that directory in the binary

1
resources/tags/v0.6.25 Normal file
View File

@ -0,0 +1 @@
2ba4c6e6ee8042e87d97d724caea8df1ac69d26b