diff options
Diffstat (limited to 'build.go')
| -rw-r--r-- | build.go | 12 | 
1 files changed, 9 insertions, 3 deletions
@@ -8,12 +8,12 @@ import (  	"strings"  	"time" -	"go.wit.com/lib/cobol"  	"go.wit.com/lib/debian"  	"go.wit.com/lib/gui/shell"  	"go.wit.com/lib/protobuf/argvpb"  	"go.wit.com/lib/protobuf/gitpb"  	"go.wit.com/log" +	"google.golang.org/protobuf/types/known/timestamppb"  )  func buildPackage(repo *gitpb.Repo) (bool, error) { @@ -102,7 +102,13 @@ func buildPackage(repo *gitpb.Repo) (bool, error) {  			//   * -s: Omit the symbol table and debug information.  			ldflags += "-s -w "  		} -		ldflags += "-X main.VERSION=" + version + " " +		gitversion := repo.GetCurrentVersion() +		if gitversion == "" { +			ldflags += "-X main.VERSION=" + version + " " +		} else { +			// use the more accurate git version in the binary itself +			ldflags += "-X main.VERSION=" + gitversion + " " +		}  		ldflags += "-X main.BUILDTIME=" + datestamp + " "  		ldflags += "-X main.GUIVERSION=" + version + "" // todo: git this from the filesystem  		cmd = append(cmd, "-ldflags", ldflags) @@ -114,7 +120,7 @@ func buildPackage(repo *gitpb.Repo) (bool, error) {  			cmd = append(cmd, "-ldflags", "-X "+flag)  		} -		me.pb.DebInfo.BuildDate = cobol.Time(time.Now()) +		me.pb.BuildDate = timestamppb.New(time.Now())  		err := repo.RunVerbose(cmd)  		if err != nil {  			return false, fmt.Errorf("go build err %v", err)  | 
