Constant build tag.

This commit is contained in:
Nuno Cruces 2022-05-02 14:03:51 +01:00
parent 85b815da3b
commit cf58f91e75
10 changed files with 23 additions and 20 deletions

View file

@ -20,7 +20,7 @@ jobs:
go-version: 1.18 go-version: 1.18
- name: Build - name: Build
run: go build -v ./... run: go build -v -tags dev ./...
- name: Test - name: Test
run: go test -v ./... run: go test -v ./...

View file

@ -1,19 +1,20 @@
#!/bin/bash #!/bin/bash
TAG=$(git tag --sort=-version:refname | head -n 1) TAG=$(git tag --points-at HEAD)
echo 'package main; const tag = "'$TAG'"' > tag.go
go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo
GOOS=windows GOARCH=386 CGO_ENABLED=0 go build -ldflags="-s -w -X main.tag=$TAG" -trimpath && GOOS=windows GOARCH=386 CGO_ENABLED=0 go build -trimpath &&
zip -9 zenity_win32.zip zenity.exe zip -9 zenity_win32.zip zenity.exe
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w -X main.tag=$TAG" -trimpath && GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -trimpath &&
zip -9 zenity_win64.zip zenity.exe zip -9 zenity_win64.zip zenity.exe
rm resource.syso rm resource.syso
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w -X main.tag=$TAG" -trimpath -o zenity_macos_x64 && GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -o zenity_macos_x64 &&
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-s -w -X main.tag=$TAG" -trimpath -o zenity_macos_arm && GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -trimpath -o zenity_macos_arm &&
go run github.com/randall77/makefat zenity zenity_macos_x64 zenity_macos_arm && go run github.com/randall77/makefat zenity zenity_macos_x64 zenity_macos_arm &&
zip -9 zenity_macos.zip zenity zip -9 zenity_macos.zip zenity
@ -22,3 +23,4 @@ rm zenity zenity_macos_* zenity.exe
GOOS=linux go build -tags dev GOOS=linux go build -tags dev
go build -tags dev go build -tags dev
git restore tag.go

View file

@ -26,8 +26,6 @@ import (
const unspecified = "\x00" const unspecified = "\x00"
var tag = ""
var ( var (
// Application Options // Application Options
errorDlg bool errorDlg bool
@ -105,9 +103,9 @@ var (
) )
func init() { func init() {
prevUsage := flag.Usage usage := flag.Usage
flag.Usage = func() { flag.Usage = func() {
prevUsage() usage()
os.Exit(-1) os.Exit(-1)
} }
} }

3
cmd/zenity/tag.go Normal file
View file

@ -0,0 +1,3 @@
package main
const tag = ""

4
go.mod
View file

@ -5,11 +5,11 @@ go 1.17
require ( require (
github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f
github.com/josephspurrier/goversioninfo v1.4.0 github.com/josephspurrier/goversioninfo v1.4.0
github.com/ncruces/go-strftime v0.1.7 github.com/ncruces/go-strftime v0.1.8
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844
go.uber.org/goleak v1.1.12 // test go.uber.org/goleak v1.1.12 // test
golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32
) )
require ( require (

8
go.sum
View file

@ -9,8 +9,8 @@ github.com/josephspurrier/goversioninfo v1.4.0/go.mod h1:JWzv5rKQr+MmW+LvM412ToT
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/ncruces/go-strftime v0.1.7 h1:FV16xPnWrx4zAD7zipPZYCzTI6ryUdQsiqPF2pUcC98= github.com/ncruces/go-strftime v0.1.8 h1:mdN5UnDgSCnhCjW0VavOAWSMT57lI5bCRXA6bxPozbg=
github.com/ncruces/go-strftime v0.1.7/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/ncruces/go-strftime v0.1.8/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 h1:GranzK4hv1/pqTIhMTXt2X8MmMOuH3hMeUR0o9SP5yc= github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 h1:GranzK4hv1/pqTIhMTXt2X8MmMOuH3hMeUR0o9SP5yc=
@ -42,8 +42,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc= golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32 h1:Js08h5hqB5xyWR789+QqueR6sDE8mk+YvpETZ+F6X9Y=
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=

View file

@ -1,3 +1,4 @@
// Package zenutil is internal. DO NOT USE.
package zenutil package zenutil
// These are internal. // These are internal.

View file

@ -4,7 +4,7 @@ package zenutil
var ( var (
Command bool Command bool
Timeout int Timeout int
LineBreak = "\n"
Separator = "\x00" Separator = "\x00"
LineBreak = "\n"
DateFormat = "%F" DateFormat = "%F"
) )

View file

@ -1,13 +1,12 @@
//go:build !windows && !darwin //go:build !windows && !darwin
// Package zenutil is internal. DO NOT USE.
package zenutil package zenutil
// These are internal. // These are internal.
var ( var (
Command bool Command bool
Timeout int Timeout int
LineBreak = "\n"
Separator = "\x1e" Separator = "\x1e"
LineBreak = "\n"
DateFormat = "%F" DateFormat = "%F"
) )

View file

@ -48,7 +48,7 @@ var res=alert.runModal
switch(res){case $.NSAlertThirdButtonReturn:$.puts({{json .Extra}}) switch(res){case $.NSAlertThirdButtonReturn:$.puts({{json .Extra}})
case $.NSAlertSecondButtonReturn:$.exit(1)} case $.NSAlertSecondButtonReturn:$.exit(1)}
var fmt=$.NSDateFormatter.alloc.init var fmt=$.NSDateFormatter.alloc.init
fmt.dateFormat={{json .Format}} fmt.locale=$.NSLocale.localeWithLocaleIdentifier("en_US_POSIX");fmt.dateFormat={{json .Format}}
fmt.stringFromDate(date.dateValue) fmt.stringFromDate(date.dateValue)
{{- end}} {{- end}}
{{define "dialog" -}} {{define "dialog" -}}