feat(agent): ajout du numéro de version v0.2.0 affiché au démarrage + script build multiplateforme
This commit is contained in:
Executable
+20
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
VERSION="0.2.0"
|
||||||
|
LDFLAGS="-X main.version=${VERSION}"
|
||||||
|
|
||||||
|
echo "Building EduBox Agent v${VERSION}..."
|
||||||
|
|
||||||
|
export PATH=$PATH:/usr/local/go/bin
|
||||||
|
|
||||||
|
GOOS=windows GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o edubox-agent.exe .
|
||||||
|
echo " edubox-agent.exe (Windows amd64)"
|
||||||
|
|
||||||
|
GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o edubox-agent .
|
||||||
|
echo " edubox-agent (Linux amd64)"
|
||||||
|
|
||||||
|
GOOS=darwin GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o edubox-agent-mac .
|
||||||
|
echo " edubox-agent-mac (macOS amd64)"
|
||||||
|
|
||||||
|
echo "Done."
|
||||||
+4
-1
@@ -8,6 +8,9 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// version is injected at build time via -ldflags "-X main.version=X.Y.Z"
|
||||||
|
var version = "dev"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
serverAddr = flag.String("server", "ws://localhost:3001", "Adresse WebSocket du serveur")
|
serverAddr = flag.String("server", "ws://localhost:3001", "Adresse WebSocket du serveur")
|
||||||
nodeID = flag.String("node-id", defaultNodeID(), "ID du nœud (défaut: hostname)")
|
nodeID = flag.String("node-id", defaultNodeID(), "ID du nœud (défaut: hostname)")
|
||||||
@@ -42,7 +45,7 @@ func main() {
|
|||||||
log.Fatalf("Cannot create data-dir: %v", err)
|
log.Fatalf("Cannot create data-dir: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("EduBox Agent - node: %s - data-dir: %s\n", *nodeID, *dataDir)
|
fmt.Printf("EduBox Agent v%s - node: %s - data-dir: %s\n", version, *nodeID, *dataDir)
|
||||||
|
|
||||||
if *uiEnabled {
|
if *uiEnabled {
|
||||||
go startUI(*dataDir, *nodeID, *serverAddr)
|
go startUI(*dataDir, *nodeID, *serverAddr)
|
||||||
|
|||||||
Reference in New Issue
Block a user