On Tue, 2024-11-19 at 15:52 +0100, Chris Burkert wrote:
> Hi Axel,
>
> > Maybe you can add something like `var _ = SkipIfIntegration` to
> > your package? i.e. trick the linter to stop it from complaining?
> >
>
>
> I already tried this, but it did not help.
>
> I even added the following, which made things worse:
>
> func init() {
> _ = SkipIfIntegration
> }
>
> $ deadcode ./...
> test/test.go:8:6: unreachable func: init#1
> test/test.go:12:6: unreachable func: SkipIfIntegration
>From the executable's docs[1],
> In any case, just because a function is reported as dead does not
> mean it is unconditionally safe to delete it. For example, a dead
> function may be referenced by another dead function, and a dead
> method may be required to satisfy an interface that is never called.
> Some judgement is required.
I'd say that this is not a linter that should be used in CI due to
false positives and the facts that CI cannot exercise judgement.
[1]https://pkg.go.dev/golang.org/x/tools/internal/cmd/deadcode
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/golang-nuts/a792ab5989322c046684b97c45c9d83961edad29.camel%40kortschak.io.