add buildtime

This commit is contained in:
sawka 2023-02-23 14:50:58 -08:00
parent 573ca55c50
commit c1b6095410
3 changed files with 11 additions and 7 deletions

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/scripthaus-dev/mshell
go 1.17
go 1.18
require (
github.com/alessio/shellescape v1.4.1

View File

@ -22,6 +22,8 @@ import (
"golang.org/x/sys/unix"
)
var BuildTime = "-"
// func doMainRun(pk *packet.RunPacketType, sender *packet.PacketSender) {
// err := shexec.ValidateRunPacket(pk)
// if err != nil {

View File

@ -1,16 +1,18 @@
```bash
# @scripthaus command build
go build -ldflags="-s -w" -o bin/mshell-v0.2-darwin.amd64 main-mshell.go
GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')"
go build -ldflags="$GO_LDFLAGS" -o bin/mshell-v0.2-darwin.amd64 main-mshell.go
```
```bash
# @scripthaus command fullbuild
go build -ldflags="-s -w" -o /Users/mike/.mshell/mshell-v0.2 main-mshell.go
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/mshell-v0.2-linux.amd64 main-mshell.go
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o bin/mshell-v0.2-linux.arm64 main-mshell.go
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o bin/mshell-v0.2-darwin.amd64 main-mshell.go
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o bin/mshell-v0.2-darwin.arm64 main-mshell.go
GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')"
go build -ldflags="$GO_LDFLAGS" -o /Users/mike/.mshell/mshell-v0.2 main-mshell.go
GOOS=linux GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o bin/mshell-v0.2-linux.amd64 main-mshell.go
GOOS=linux GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o bin/mshell-v0.2-linux.arm64 main-mshell.go
GOOS=darwin GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o bin/mshell-v0.2-darwin.amd64 main-mshell.go
GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o bin/mshell-v0.2-darwin.arm64 main-mshell.go
```