hub: gofmt -w on 22 files, formatting only, no behaviour change (R-1160)

This commit is contained in:
admin committed 2026-10-19 10:26:36 +02:00
1 parent db2371c6f5
commit d5e3c8b0d9
22 files changed
+81 -73

No files matched your search

@@ -29,7 +29,7 @@ type fakeRegistry struct {
downloadGone map[string]bool
// shaless models a version whose metadata answers but carries no sha256.
shaless map[string]bool
hits int
hits int
}
func (f *fakeRegistry) start(t *testing.T) *gitea.Client {
+4 -4
View File
@@ -116,10 +116,10 @@ func TestTemplates_CustomerHostTab(t *testing.T) {
// The Host tab panel carries the host_detail_body content.
for _, want := range []string{
"demo-felhom-01", // host identity
"Storage Targets", // shared body section
"felhom-usb", // storage target from the report
">9201<", // guest vmid
"demo-felhom-01", // host identity
"Storage Targets", // shared body section
"felhom-usb", // storage target from the report
">9201<", // guest vmid
`href="/hosts/demo-felhom-01"`, // cross-link to the standalone page
} {
if !strings.Contains(html, want) {
+9 -9
View File
@@ -13,15 +13,15 @@ func TestStatusColorTruthTable(t *testing.T) {
status string
want string
}{
{"ok", "nominal"}, // operating normally — blue
{"warn", "warn"}, // degraded / stale report — amber
{"stale", "warn"}, // host stale state
{"down", "crit"}, // outage — red
{"fail", "crit"}, // health=fail — red
{"pending", "neutral"}, // not-yet-provisioned customer is a NORMAL fleet state
{"disabled", "neutral"}, // deliberately paused — not a deviation
{"blocked", "warn"}, // operator cut-off: intentional but attention-worthy
{"bogus", "neutral"}, // unknown values stay quiet
{"ok", "nominal"}, // operating normally — blue
{"warn", "warn"}, // degraded / stale report — amber
{"stale", "warn"}, // host stale state
{"down", "crit"}, // outage — red
{"fail", "crit"}, // health=fail — red
{"pending", "neutral"}, // not-yet-provisioned customer is a NORMAL fleet state
{"disabled", "neutral"}, // deliberately paused — not a deviation
{"blocked", "warn"}, // operator cut-off: intentional but attention-worthy
{"bogus", "neutral"}, // unknown values stay quiet
{"", "neutral"},
}
for _, c := range cases {
+8 -8
View File
@@ -143,14 +143,14 @@ func (s *Server) handleOffsite(w http.ResponseWriter, r *http.Request) {
pbsView := s.pbsdrBoxData() // R-5 v0.65.0 PBS-DR datastore panel (PBS DR tab)
data := map[string]interface{}{
"Endpoints": cards,
"HasEndpoints": len(cards) > 0,
"Peers": rows,
"OffsiteBox": boxView,
"OffsiteCusts": custRows,
"PBSBox": pbsView,
"CSRFToken": s.getCSRFToken(r),
"Flash": r.URL.Query().Get("flash"),
"Endpoints": cards,
"HasEndpoints": len(cards) > 0,
"Peers": rows,
"OffsiteBox": boxView,
"OffsiteCusts": custRows,
"PBSBox": pbsView,
"CSRFToken": s.getCSRFToken(r),
"Flash": r.URL.Query().Get("flash"),
}
if err := s.templates.ExecuteTemplate(w, "offsite.html", data); err != nil {
s.logger.Printf("[ERROR] offsite.html template: %v", err)
+4 -1
View File
@@ -147,7 +147,10 @@ func TestFmtBytesAuto_ScalesInsteadOfCollapsingToZero(t *testing.T) {
// The Offsite page's fmtBytesGB renders demo-hp's real size as "0.1 GB". On a card whose entire
// defect was under-reporting a real backup, that reads as "nearly nothing" — which is why this
// formatter exists rather than reusing that one.
for _, tc := range []struct{ in int64; want string }{
for _, tc := range []struct {
in int64
want string
}{
{140829678, "134.3 MB"}, // demo-hp, measured
{0, "0 B"},
{1 << 10, "1.0 KB"},
-1
View File
@@ -254,7 +254,6 @@ func (s *Server) tokenRows() []tokenRow {
// tokenDaysChoices are the expiry options of the create form; "never" is not offered.
var tokenDaysChoices = []int{30, tokenDefaultDays, 180, tokenMaxDays}
// Handler is the operator web surface as main mounts it: ServeHTTP behind RequireAuth, unconditionally.
func (s *Server) Handler() http.Handler {
return s.RequireAuth(http.HandlerFunc(s.ServeHTTP))