Cobra doesn't obey the build-time variables

Signed-off-by: Shin'ya Minazuki <shinyoukai@laidback.moe>
This commit is contained in:
2026-01-22 13:43:48 -03:00
parent 3def8e4eee
commit 618908f54b
4 changed files with 2 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
GO ?= go
GOFLAGS ?= -buildvcs=false -ldflags='-w -X code.laidback.moe/yuki.Version=1.0' -buildmode=exe -v
GOFLAGS ?= -buildmode=exe -buildvcs=false -v
PREFIX ?= /usr/local
all: build

View File

@@ -6,10 +6,6 @@ env:
GO: go
GOTELEMETRY: off
vars:
IMPORT: code.laidback.moe/yuki
VERSION: 2026.01.21
tasks:
default:
cmds:
@@ -17,7 +13,7 @@ tasks:
build:
desc: Build the interface
cmds:
- $GO build -v -ldflags='-w -X {{.IMPORT}}.Version={{.VERSION}}' -buildvcs=false -o yuki
- $GO build -buildmode=exe -buildvcs=false -v
clean:
desc: Remove generated files
cmds:

View File

@@ -8,7 +8,6 @@ import (
var rootCmd = &cobra.Command{
Use: "yuki",
Short: "An extraterrestial client for WriteFreely",
Version: FullVersion(),
}
func Execute() {

View File

@@ -1,17 +0,0 @@
package main
import (
"fmt"
)
var (
Revision = "0"
Version = "0"
)
func FullVersion() string {
return fmt.Sprintf("%s (r%s)", Version, Revision)
}
func PrintVersion() string {
return fmt.Sprintf("%s", Version)
}