feat: Inject copyright year at build time and update version handling in build script
This commit is contained in:
@@ -78,13 +78,14 @@ if (-not (Test-Path $OutputDir)) {
|
||||
Write-Host "Created output directory: $OutputDir" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Build flags — always inject version; release builds also strip debug symbols.
|
||||
$versionLdflag = "-X main.version=$gitTag"
|
||||
# Build flags — always inject version and copyright year; release builds also strip debug symbols.
|
||||
$buildYear = (Get-Date).Year
|
||||
$injectedFlags = "-X main.version=$gitTag -X main.copyrightYear=$buildYear"
|
||||
if ($Release) {
|
||||
$ldflags = "-s -w $versionLdflag"
|
||||
$ldflags = "-s -w $injectedFlags"
|
||||
Write-Host "Building RELEASE version (optimized, no debug symbols)..." -ForegroundColor Green
|
||||
} else {
|
||||
$ldflags = $versionLdflag
|
||||
$ldflags = $injectedFlags
|
||||
Write-Host "Building DEBUG version (with debug symbols)..." -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
|
||||
@@ -14,13 +14,14 @@ import (
|
||||
"ekdns/resolver"
|
||||
)
|
||||
|
||||
// version is set at build time via -ldflags "-X main.version=..."
|
||||
// version and copyrightYear are set at build time via -ldflags.
|
||||
var version = "dev"
|
||||
var copyrightYear = "2024"
|
||||
|
||||
func main() {
|
||||
// Banner (always printed to stdout).
|
||||
fmt.Printf("ekDNSHelper %s\n", version)
|
||||
fmt.Println("Copyright (c) 2024 Emberkom LLC")
|
||||
fmt.Printf("Copyright (c) %s Emberkom LLC\n", copyrightYear)
|
||||
fmt.Println("")
|
||||
|
||||
if len(os.Args) < 2 {
|
||||
|
||||
Reference in New Issue
Block a user