Skip to content

Commit 5081091

Browse files
atharrva01AkramBitar
authored andcommitted
lint: enable ireturn
Next step of #1991. All 64 hits were returns of third-party interfaces, and in every case the signature is not ours to change: either the method implements that interface (driver.Pagination, bccsp.Key, metrics.Provider) or it is the framework's own constructor convention (view.View, view.Session). So this allows those 15 interfaces rather than touching any code. No source files change, ireturn still catches new cases of our own types. Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
1 parent 0dffd30 commit 5081091

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

.golangci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ linters:
1616
- govet # Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes. [auto-fix]
1717
- importas # Enforces consistent import aliases. [auto-fix]
1818
- intrange # Intrange is a linter to find places where for loops could make use of an integer range. [auto-fix]
19+
- ireturn # Accept Interfaces, Return Concrete Types.
1920
- loggercheck # Checks key value pairs for common logger libraries (kitlog,klog,logr,slog,zap).
2021
- lll # Reports long lines. [fast]
2122
- mirror # Reports wrong mirror patterns of bytes/strings usage. [auto-fix]
@@ -90,6 +91,31 @@ linters:
9091
- github.com/prometheus/client_golang/prometheus.Counter
9192
- github.com/prometheus/client_golang/prometheus.Gauge
9293
- github.com/prometheus/client_golang/prometheus.Histogram
94+
# Third-party interfaces we are obliged to return: either the signature is fixed by an
95+
# interface we implement (Pagination, bccsp.Key, KeyStore) or it is the framework's own
96+
# constructor convention (view.View, view.Session). Returning a concrete type instead is
97+
# not an option in these cases, so allow them rather than carry a nolint at every site.
98+
- github.com/hyperledger-labs/fabric-smart-client/platform/common/driver.Pagination
99+
- github.com/hyperledger-labs/fabric-smart-client/platform/view/view.View
100+
- github.com/hyperledger-labs/fabric-smart-client/platform/view/view.Session
101+
- github.com/hyperledger/fabric-lib-go/bccsp.Key
102+
- github.com/hyperledger/fabric-lib-go/bccsp.BCCSP
103+
- github.com/hyperledger/fabric-lib-go/bccsp.HashOpts
104+
- github.com/IBM/idemix/bccsp/types.BCCSP
105+
- github.com/IBM/idemix/bccsp/types.KeyStore
106+
- go.opentelemetry.io/otel/trace.Span
107+
- github.com/hyperledger/fabric-lib-go/common/metrics.Gauge
108+
- github.com/hyperledger/fabric-lib-go/common/metrics.Histogram
109+
- github.com/hyperledger-labs/fabric-smart-client/platform/common/driver.ConfigService
110+
- github.com/hyperledger-labs/fabric-smart-client/integration/nwo/api.ViewClient
111+
- github.com/hyperledger-labs/fabric-smart-client/integration/nwo/api.Platform
112+
- github.com/hyperledger-labs/fabric-smart-client/integration/nwo/api.Context
113+
- github.com/hyperledger/fabric-lib-go/common/metrics.Gauge
114+
- github.com/hyperledger/fabric-lib-go/common/metrics.Histogram
115+
- github.com/hyperledger-labs/fabric-smart-client/platform/common/driver.ConfigService
116+
- github.com/hyperledger-labs/fabric-smart-client/integration/nwo/api.ViewClient
117+
- github.com/hyperledger-labs/fabric-smart-client/integration/nwo/api.Platform
118+
- github.com/hyperledger-labs/fabric-smart-client/integration/nwo/api.Context
93119
lll:
94120
# Max line length, lines longer will be reported.
95121
line-length: 240

0 commit comments

Comments
 (0)