fix: use time.Now() for BuildDate instead of shell date command (Windows-kompatibel)
This commit is contained in:
parent
3c2c3cef57
commit
ad8f7937b1
1 changed files with 2 additions and 4 deletions
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/magefile/mage/mg"
|
"github.com/magefile/mage/mg"
|
||||||
"github.com/magefile/mage/sh"
|
"github.com/magefile/mage/sh"
|
||||||
|
|
@ -23,10 +24,7 @@ func ldflags() (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
commit = "none"
|
commit = "none"
|
||||||
}
|
}
|
||||||
buildDate, err := sh.Output("date", "-u", "+%Y-%m-%dT%H:%M:%SZ")
|
buildDate := time.Now().UTC().Format(time.RFC3339)
|
||||||
if err != nil {
|
|
||||||
buildDate = "unknown"
|
|
||||||
}
|
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf(
|
||||||
`-X code.beautifulmachines.dev/jakoubek/csv2excel/internal/version.Version=%s -X code.beautifulmachines.dev/jakoubek/csv2excel/internal/version.Commit=%s -X code.beautifulmachines.dev/jakoubek/csv2excel/internal/version.BuildDate=%s`,
|
`-X code.beautifulmachines.dev/jakoubek/csv2excel/internal/version.Version=%s -X code.beautifulmachines.dev/jakoubek/csv2excel/internal/version.Commit=%s -X code.beautifulmachines.dev/jakoubek/csv2excel/internal/version.BuildDate=%s`,
|
||||||
version, commit, buildDate,
|
version, commit, buildDate,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue