You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an interface is embedded, the reported interface name isn't what you need to ignore. Concretely, extend wrapcheck/testdata/config_ignoreInterfaceRegexps/main.go with the following, and run the test.
typeembedderinterface {
errorer
}
funcembed(fnembedder) error {
varstrstringreturnfn.Decode(&str) // errorer interface ignored as per `ignoreInterfaceRegexps`
}
Unexpectedly, you'll see the following:
--- FAIL: TestAnalyzer (5.40s)
--- FAIL: TestAnalyzer/config_ignoreInterfaceRegexps (0.25s)
analysistest.go:452: /home/murman/src/wrapcheck/wrapcheck/testdata/config_ignoreInterfaceRegexps/main.go:33:9: unexpected diagnostic: error returned from interface method should be wrapped: sig: func (_/home/murman/src/wrapcheck/wrapcheck/testdata/config_ignoreInterfaceRegexps.errorer).Decode(v interface{}) error
Note that the ignores include errorer and the reported interface is config_ignoreInterfaceRegexps.errorer. However to suppress this you actually need to suppress embedder.
I believe this comes down to the difference between name and fnSig in reportUnwrapped, which come from sel.Sel and sel.X respectively, but the path forward is unclear to me.
When an interface is embedded, the reported interface name isn't what you need to ignore. Concretely, extend
wrapcheck/testdata/config_ignoreInterfaceRegexps/main.go
with the following, and run the test.Unexpectedly, you'll see the following:
Note that the ignores include
errorer
and the reported interface isconfig_ignoreInterfaceRegexps.errorer
. However to suppress this you actually need to suppressembedder
.I believe this comes down to the difference between name and fnSig in reportUnwrapped, which come from sel.Sel and sel.X respectively, but the path forward is unclear to me.
wrapcheck/wrapcheck/wrapcheck.go
Lines 257 to 260 in 2133185
The text was updated successfully, but these errors were encountered: