v1.0.0 — first release

Bump VERSION to 1.0.0 and cut the first tagged release of vpp-maglev.

Also in this commit:

- maglevc: MAGLEV_SERVER env var as an alternative to the --server
  flag, matching the MAGLEV_CONFIG / MAGLEV_GRPC_ADDR convention on
  the other binaries. The flag takes precedence when both are set.
- Rename cmd/maglevd -> cmd/server and cmd/maglevc -> cmd/client so
  the source directory names are decoupled from binary names (the
  frontend and tester commands already followed this convention).
  Build outputs and the Debian packages are unchanged.
This commit is contained in:
2026-04-15 15:23:46 +02:00
parent 177d81cca1
commit bc6ccaa844
15 changed files with 33 additions and 17 deletions

52
cmd/client/color.go Normal file
View File

@@ -0,0 +1,52 @@
// Copyright (c) 2026, Pim van Pelt <pim@ipng.ch>
package main
import "strings"
const (
ansiBlue = "\x1b[34m"
ansiRed = "\x1b[31m"
ansiReset = "\x1b[0m"
)
// colorEnabled is set by the -color flag in main.
var colorEnabled bool
// label wraps s in dark-blue ANSI when color output is enabled.
//
// Tabwriter caveat: tabwriter.Writer counts *bytes* per cell, not
// rendered columns. ANSI escape codes (`\x1b[34m…\x1b[0m`, 11 bytes)
// inflate a cell's apparent width without affecting what the terminal
// draws. Two things follow:
//
// 1. Key-value layouts where column 1 is *always* labelled and
// column 2 is *always* plain (e.g. `show vpp info`) stay aligned,
// because every row adds the same 11 bytes to column 1.
// 2. Multi-column tables where only the *header* row is labelled
// drift: the header cells each carry 11 extra bytes that the data
// rows don't, so data cells get over-padded. In those tables,
// leave the header plain (see runShowVPPLBCounters) and only use
// label() for labels that appear uniformly column-wise.
func label(s string) string {
if !colorEnabled {
return s
}
return ansiBlue + s + ansiReset
}
// formatError returns a user-friendly error string. gRPC status errors are
// unwrapped to show only the server's message (no "rpc error: code = ..."
// boilerplate). The result is wrapped in red ANSI when color is enabled.
func formatError(err error) string {
msg := err.Error()
// google.golang.org/grpc/status errors format as:
// rpc error: code = <Code> desc = <message>
if i := strings.Index(msg, " desc = "); i >= 0 {
msg = msg[i+len(" desc = "):]
}
if colorEnabled {
return ansiRed + msg + ansiReset
}
return msg
}