Re: [go-nuts] deadcode: unreachable func which is exclusively used in tests

2024-11-19 Thread 'Dan Kortschak' via golang-nuts
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, wh

Re: [go-nuts] deadcode: unreachable func which is exclusively used in tests

2024-11-19 Thread Chris Burkert
Well, the init() function in the test package leads to an additional complaint: $ deadcode ./... test/test.go:8:6: unreachable func: init#1 test/test.go:14:6: unreachable func: SkipIfIntegration It works it I import the test package in my main package and fake call it there: if false { test.SkipI

Re: [go-nuts] deadcode: unreachable func which is exclusively used in tests

2024-11-19 Thread 'Axel Wagner' via golang-nuts
Hm, sorry, no, come to think of it, that wouldn't help either. So, I don't know. Apart from "don't use that linter" or "ignore that complaint", I'm out of ideas. On Tue, 19 Nov 2024 at 15:56, Axel Wagner wrote: > You could also call it from a test within your test package. > > On Tue, 19 Nov 202

Re: [go-nuts] deadcode: unreachable func which is exclusively used in tests

2024-11-19 Thread 'Axel Wagner' via golang-nuts
You could also call it from a test within your test package. On Tue, 19 Nov 2024 at 15:53, 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 d

Re: [go-nuts] deadcode: unreachable func which is exclusively used in tests

2024-11-19 Thread Chris Burkert
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 ./... t

[go-nuts] deadcode: unreachable func which is exclusively used in tests

2024-11-19 Thread Chris Burkert
Hey there, I have a package "test", which is only used in tests and which contains one function: https://go.dev/play/p/Ne1xGXsQNmy This leads to a finding when running deadcode: $ deadcode ./... test/testg.go:8:6: unreachable func: SkipIfIntegration I tried several things: - renaming the packag

Re: [go-nuts] deadcode: unreachable func which is exclusively used in tests

2024-11-19 Thread 'Axel Wagner' via golang-nuts
On Tue, 19 Nov 2024 at 15:25, Chris Burkert wrote: > Hey there, > > I have a package "test", which is only used in tests and which contains > one function: https://go.dev/play/p/Ne1xGXsQNmy > > This leads to a finding when running deadcode: > > $ deadcode ./... > test/testg.go:8:6: unreachable fu