From 815085e87137741b3675dc54ba8e82b5d2892aed Mon Sep 17 00:00:00 2001 From: Winter Date: Sat, 16 Aug 2025 14:10:24 -0400 Subject: [PATCH] *.go: fix vet checks Change-Id: xvnlorpzrukztrvxvkqqmvwmwrtstuop Signed-off-by: Winter --- appview/pages/funcmap.go | 30 +++++++++++++++--------------- appview/reporesolver/resolver.go | 2 +- appview/spindles/spindles.go | 2 +- appview/state/state.go | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go index a0926660..38361d0b 100644 --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -124,21 +124,21 @@ func (p *Pages) funcMap() template.FuncMap { "relTimeFmt": humanize.Time, "shortRelTimeFmt": func(t time.Time) string { return humanize.CustomRelTime(t, time.Now(), "", "", []humanize.RelTimeMagnitude{ - {time.Second, "now", time.Second}, - {2 * time.Second, "1s %s", 1}, - {time.Minute, "%ds %s", time.Second}, - {2 * time.Minute, "1min %s", 1}, - {time.Hour, "%dmin %s", time.Minute}, - {2 * time.Hour, "1hr %s", 1}, - {humanize.Day, "%dhrs %s", time.Hour}, - {2 * humanize.Day, "1d %s", 1}, - {20 * humanize.Day, "%dd %s", humanize.Day}, - {8 * humanize.Week, "%dw %s", humanize.Week}, - {humanize.Year, "%dmo %s", humanize.Month}, - {18 * humanize.Month, "1y %s", 1}, - {2 * humanize.Year, "2y %s", 1}, - {humanize.LongTime, "%dy %s", humanize.Year}, - {math.MaxInt64, "a long while %s", 1}, + {D: time.Second, Format: "now", DivBy: time.Second}, + {D: 2 * time.Second, Format: "1s %s", DivBy: 1}, + {D: time.Minute, Format: "%ds %s", DivBy: time.Second}, + {D: 2 * time.Minute, Format: "1min %s", DivBy: 1}, + {D: time.Hour, Format: "%dmin %s", DivBy: time.Minute}, + {D: 2 * time.Hour, Format: "1hr %s", DivBy: 1}, + {D: humanize.Day, Format: "%dhrs %s", DivBy: time.Hour}, + {D: 2 * humanize.Day, Format: "1d %s", DivBy: 1}, + {D: 20 * humanize.Day, Format: "%dd %s", DivBy: humanize.Day}, + {D: 8 * humanize.Week, Format: "%dw %s", DivBy: humanize.Week}, + {D: humanize.Year, Format: "%dmo %s", DivBy: humanize.Month}, + {D: 18 * humanize.Month, Format: "1y %s", DivBy: 1}, + {D: 2 * humanize.Year, Format: "2y %s", DivBy: 1}, + {D: humanize.LongTime, Format: "%dy %s", DivBy: humanize.Year}, + {D: math.MaxInt64, Format: "a long while %s", DivBy: 1}, }) }, "longTimeFmt": func(t time.Time) string { diff --git a/appview/reporesolver/resolver.go b/appview/reporesolver/resolver.go index c622c293..d3d9a838 100644 --- a/appview/reporesolver/resolver.go +++ b/appview/reporesolver/resolver.go @@ -274,7 +274,7 @@ func (f *ResolvedRepo) RepoInfo(user *oauth.User) repoinfo.RepoInfo { func (f *ResolvedRepo) RolesInRepo(u *oauth.User) repoinfo.RolesInRepo { if u != nil { r := f.rr.enforcer.GetPermissionsInRepo(u.Did, f.Knot, f.DidSlashRepo()) - return repoinfo.RolesInRepo{r} + return repoinfo.RolesInRepo{Roles: r} } else { return repoinfo.RolesInRepo{} } diff --git a/appview/spindles/spindles.go b/appview/spindles/spindles.go index 6c7a5eb5..81a1e1ca 100644 --- a/appview/spindles/spindles.go +++ b/appview/spindles/spindles.go @@ -442,7 +442,7 @@ func (s *Spindles) retry(w http.ResponseWriter, r *http.Request) { } w.Header().Set("HX-Reswap", "outerHTML") - s.Pages.SpindleListing(w, pages.SpindleListingParams{verifiedSpindle[0]}) + s.Pages.SpindleListing(w, pages.SpindleListingParams{Spindle: verifiedSpindle[0]}) } func (s *Spindles) addMember(w http.ResponseWriter, r *http.Request) { diff --git a/appview/state/state.go b/appview/state/state.go index e09e67ed..8d8f5295 100644 --- a/appview/state/state.go +++ b/appview/state/state.go @@ -81,7 +81,7 @@ func Make(ctx context.Context, config *config.Config) (*State, error) { repoResolver := reporesolver.New(config, enforcer, res, d) - wrapper := db.DbWrapper{d} + wrapper := db.DbWrapper{Execer: d} jc, err := jetstream.NewJetstreamClient( config.Jetstream.Endpoint, "appview", -- 2.43.0 From 55013dfcfd85a7a7d8de06bd1676ce27493201bb Mon Sep 17 00:00:00 2001 From: Winter Date: Sat, 16 Aug 2025 14:12:35 -0400 Subject: [PATCH] ci: run `go vet` Change-Id: zvtqtworuppktousslnystmlkrlspokq Signed-off-by: Winter --- .tangled/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.tangled/workflows/test.yml b/.tangled/workflows/test.yml index 2039068e..d5489e4c 100644 --- a/.tangled/workflows/test.yml +++ b/.tangled/workflows/test.yml @@ -12,6 +12,10 @@ steps: command: | mkdir -p appview/pages/static; touch appview/pages/static/x + - name: run vet + command: | + go vet ./... + - name: run all tests environment: CGO_ENABLED: 1 -- 2.43.0