googleapis / googleapis/google-cloud-go

add unparam as a presubmit check

Open
#10,782 1 comment 1 reaction 0 assignees View on GitHub
type: process
Dominant language
Go
Stars
4.5k
Forks
1.6k
Avg merge
1d 13h
Merged PRs (30d)
109

Description

[unparam](https://github.com/googleapis/gapic-generator-go/issues/mvdan.cc/unparam) is a common linter for Go projects. We should consider adding it as a presubmit check for PRs to catch things like https://github.com/googleapis/gapic-generator-go/pull/1407

See https://github.com/googleapis/gapic-generator-go/issues/1408 for a related issue.

Example issues in this repository:

```
auth ❯ unparam ./...
credentials/impersonate/user.go:33:123: user - result 1 (error) is always nil
internal/transport/cert/cmd/test_signer.go:59:95: (*EnterpriseCertSigner).CertificateChain - result 0 (error) is always nil
```

```
bigquery ❯ unparam ./...
iterator.go:369:22: fetchCachedPage - ctx is unused
model.go:232:54: bqToModelMetadata - result 1 (error) is always nil
routine.go:240:87: bqToRemoteFunctionOptions - result 1 (error) is always nil
routine.go:258:70: (*RemoteFunctionOptions).toBQ - result 1 (error) is always nil
storage/managedwriter/adapt/protoconversion.go:414:158: tableFieldSchemaToFieldDescriptorProto - result 1 (error) is always nil
storage/managedwriter/managed_stream.go:197:60: (*ManagedStream).appendWithRetry - opts is unused
storage/managedwriter/managed_stream.go:358:57: (*ManagedStream).processRetry - srcConn is unused
storage/managedwriter/retry.go:36:46: retryPredicate - result aggressiveBackoff is always false
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.