From 553cc7bbf577a297ad6e78870316bdf5e4c19e04 Mon Sep 17 00:00:00 2001 From: Jonathan Amsterdam Date: Sat, 28 Mar 2026 14:40:24 -0400 Subject: all.bash: re-enable unparam It's working now. Also fix, issues that it detected. Change-Id: Ifd3fe5baf9a56d31bafe099bf4b38e02356bde21 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/760582 Reviewed-by: Hyang-Ah Hana Kim LUCI-TryBot-Result: Go LUCI kokoro-CI: kokoro Reviewed-by: Ethan Lee --- all.bash | 6 ++---- cmd/internal/pkgsite/server.go | 2 +- internal/fetch/load.go | 8 +++++--- internal/worker/excluded.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/all.bash b/all.bash index a8d81c2c..de916ea8 100755 --- a/all.bash +++ b/all.bash @@ -140,10 +140,8 @@ check_bad_migrations() { # check_unparam runs unparam on source files. check_unparam() { - echo "unparam disabled until ssa supports generics" - # TODO: uncomment when working - # ensure_go_binary mvdan.cc/unparam - # runcmd unparam ./... + ensure_go_binary mvdan.cc/unparam + runcmd unparam ./... } # check_vet runs go vet on source files. diff --git a/cmd/internal/pkgsite/server.go b/cmd/internal/pkgsite/server.go index 32986a54..d1fb19d7 100644 --- a/cmd/internal/pkgsite/server.go +++ b/cmd/internal/pkgsite/server.go @@ -123,7 +123,7 @@ func BuildServer(ctx context.Context, serverCfg ServerConfig) (*frontend.Server, // // An error is returned if any operations failed unexpectedly, or if no // requested directories contain any valid modules. -func getModuleDirs(ctx context.Context, dirs []string, goRepoPath string, allowNoModules bool) (map[string][]frontend.LocalModule, error) { +func getModuleDirs(_ context.Context, dirs []string, goRepoPath string, allowNoModules bool) (map[string][]frontend.LocalModule, error) { dirModules := make(map[string][]frontend.LocalModule) for _, dir := range dirs { output, err := runGo(dir, "list", "-m", "-json") diff --git a/internal/fetch/load.go b/internal/fetch/load.go index bde5469d..e8f03316 100644 --- a/internal/fetch/load.go +++ b/internal/fetch/load.go @@ -51,7 +51,8 @@ func (bpe *BadPackageError) Error() string { return bpe.Err.Error() } // If a package is fine except that its documentation is too large, loadPackage // returns a goPackage whose err field is a non-nil error with godoc.ErrTooLarge in its chain. func loadPackage(ctx context.Context, contentDir fs.FS, goFilePaths []string, innerPath string, - sourceInfo *source.Info, modInfo *godoc.ModuleInfo) (_ *goPackage, err error) { + sourceInfo *source.Info, modInfo *godoc.ModuleInfo, +) (_ *goPackage, err error) { defer derrors.Wrap(&err, "loadPackage(ctx, zipGoFiles, %q, sourceInfo, modInfo)", innerPath) ctx, span := trace.StartSpan(ctx, "fetch.loadPackage") defer span.End() @@ -185,7 +186,7 @@ func loadPackage(ctx context.Context, contentDir fs.FS, goFilePaths []string, in // loadPackageMeta loads only the parts of a package that are needed to load a // packageMeta. -func loadPackageMeta(ctx context.Context, contentDir fs.FS, goFilePaths []string, innerPath string, modInfo *godoc.ModuleInfo) (_ *packageMeta, err error) { +func loadPackageMeta(_ context.Context, contentDir fs.FS, goFilePaths []string, innerPath string, modInfo *godoc.ModuleInfo) (_ *packageMeta, err error) { defer derrors.Wrap(&err, "loadPackageMeta(ctx, zipGoFiles, %q, sourceInfo, modInfo)", innerPath) // Make a map with all the zip file contents. @@ -285,7 +286,8 @@ var httpPost = http.Post // If it returns an error with ErrTooLarge in its chain, the other return values // are still valid. func loadPackageForBuildContext(ctx context.Context, files map[string][]byte, innerPath string, sourceInfo *source.Info, modInfo *godoc.ModuleInfo) ( - name string, imports []string, synopsis string, source []byte, api []*internal.Symbol, err error) { + name string, imports []string, synopsis string, source []byte, api []*internal.Symbol, err error, +) { modulePath := modInfo.ModulePath defer derrors.Wrap(&err, "loadPackageWithBuildContext(files, %q, %q, %+v)", innerPath, modulePath, sourceInfo) diff --git a/internal/worker/excluded.go b/internal/worker/excluded.go index cec802a0..9e8c7c37 100644 --- a/internal/worker/excluded.go +++ b/internal/worker/excluded.go @@ -55,7 +55,7 @@ func PopulateExcluded(ctx context.Context, cfg *config.Config, db *postgres.DB) } } defer r.Close() - lines, err := readExcludedLines(ctx, r) + lines, err := readExcludedLines(r) if err != nil { return err } @@ -77,7 +77,7 @@ func PopulateExcluded(ctx context.Context, cfg *config.Config, db *postgres.DB) return nil } -func readExcludedLines(ctx context.Context, r io.Reader) ([]exclusion, error) { +func readExcludedLines(r io.Reader) ([]exclusion, error) { var lines []exclusion s := bufio.NewScanner(r) for s.Scan() { -- cgit v1.3