docs: community polish for public readiness #21

Merged
lerko merged 6 commits from chore/community-polish into main 2026-05-24 19:40:01 +00:00
2 changed files with 21 additions and 1 deletions
Showing only changes of commit 8f9210b451 - Show all commits
+4 -1
View File
@@ -6,7 +6,10 @@ COPY go.mod go.sum ./
RUN go mod download RUN go mod download
COPY . . COPY . .
ENV CGO_ENABLED=1 ENV CGO_ENABLED=1
RUN go build -ldflags="-s -w" -o go-upkeep ./cmd/goupkeep/main.go ARG VERSION=dev
ARG COMMIT=none
ARG BUILD_DATE=unknown
RUN go build -ldflags="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${BUILD_DATE}" -o go-upkeep ./cmd/goupkeep/main.go
# --- Stage 2: Runner --- # --- Stage 2: Runner ---
FROM alpine:latest FROM alpine:latest
+17
View File
@@ -27,6 +27,12 @@ import (
"github.com/mattn/go-isatty" "github.com/mattn/go-isatty"
) )
var (
version = "dev"
commit = "none"
date = "unknown"
)
func main() { func main() {
log.SetOutput(os.Stderr) log.SetOutput(os.Stderr)
@@ -38,11 +44,22 @@ func main() {
case "export": case "export":
runExport(os.Args[2:]) runExport(os.Args[2:])
return return
case "version", "--version", "-v":
printVersion()
return
} }
} }
runServe(os.Args[1:]) runServe(os.Args[1:])
} }
func printVersion() {
if version == "dev" {
fmt.Println("go-upkeep dev")
} else {
fmt.Printf("go-upkeep %s (%s, %s)\n", version, commit, date)
}
}
func envOrDefault(key, fallback string) string { func envOrDefault(key, fallback string) string {
if v := os.Getenv(key); v != "" { if v := os.Getenv(key); v != "" {
return v return v