go-server-sdk icon indicating copy to clipboard operation
go-server-sdk copied to clipboard

testing package is used in non-tests code

Open gm42 opened this issue 1 year ago • 3 comments

Is this a support request? No

Describe the bug The LaunchDarkly Go SDK depends on testing package; this increases the size of release binaries and will create issues when accessing the command-line flags because they will be parsed by the testing package global init() first.

To reproduce

for PKG in github.com/launchdarkly/ccache github.com/launchdarkly/eventsource github.com/launchdarkly/go-jsonstream/v3/jreader github.com/launchdarkly/go-jsonstream/v3/jwriter github.com/launchdarkly/go-sdk-common/v3/ldattr github.com/launchdarkly/go-sdk-common/v3/ldcontext github.com/launchdarkly/go-sdk-common/v3/lderrors github.com/launchdarkly/go-sdk-common/v3/ldlog github.com/launchdarkly/go-sdk-common/v3/ldreason github.com/launchdarkly/go-sdk-common/v3/ldtime github.com/launchdarkly/go-sdk-common/v3/ldvalue github.com/launchdarkly/go-sdk-events/v2 github.com/launchdarkly/go-semver github.com/launchdarkly/go-server-sdk-evaluation/v2 github.com/launchdarkly/go-server-sdk-evaluation/v2/internal github.com/launchdarkly/go-server-sdk-evaluation/v2/ldmodel github.com/launchdarkly/go-server-sdk/v6 github.com/launchdarkly/go-server-sdk/v6/interfaces github.com/launchdarkly/go-server-sdk/v6/interfaces/flagstate github.com/launchdarkly/go-server-sdk/v6/internal github.com/launchdarkly/go-server-sdk/v6/internal/bigsegments github.com/launchdarkly/go-server-sdk/v6/internal/datakinds github.com/launchdarkly/go-server-sdk/v6/internal/datasource github.com/launchdarkly/go-server-sdk/v6/internal/datastore github.com/launchdarkly/go-server-sdk/v6/internal/endpoints github.com/launchdarkly/go-server-sdk/v6/ldcomponents github.com/launchdarkly/go-server-sdk/v6/ldhttp github.com/launchdarkly/go-server-sdk/v6/subsystems github.com/launchdarkly/go-server-sdk/v6/subsystems/ldstoreimpl github.com/launchdarkly/go-server-sdk/v6/subsystems/ldstoretypes; do echo -n "$PKG: "; go list -deps $PKG | grep testing; echo; done | grep testing | awk -F: '{ print $1 }'

Output:

github.com/launchdarkly/go-semver
github.com/launchdarkly/go-server-sdk-evaluation/v2/ldmodel
github.com/launchdarkly/go-server-sdk-evaluation/v2
github.com/launchdarkly/go-server-sdk/v6/internal/datakinds
github.com/launchdarkly/go-server-sdk/v6/internal/datastore
github.com/launchdarkly/go-server-sdk/v6/subsystems/ldstoreimpl
github.com/launchdarkly/go-server-sdk/v6/internal/datasource
github.com/launchdarkly/go-server-sdk/v6/ldcomponents
github.com/launchdarkly/go-server-sdk/v6

Expected behavior Only tests should depend on testing.

Logs No logs

SDK version v3.0.1

Language version, developer tools go version go1.20.4 linux/amd6

OS/platform Linux

Additional context You can find similar bug reports in other open source SDKs

gm42 avatar Sep 11 '23 08:09 gm42

Hi @gm42, thanks for the report. I agree this isn't optimal.

Filed internally as 216653.

cwaldren-ld avatar Sep 11 '23 17:09 cwaldren-ld

Any news on this? It's the only dependency we have which links testing

gm42 avatar Nov 09 '23 12:11 gm42

Sorry - no updates. It is on our backlog.

cwaldren-ld avatar Nov 13 '23 17:11 cwaldren-ld

Hi @gm42, as of 7.6.2 the Go Server SDK should no longer pull in the "testing" dependency.

cwaldren-ld avatar Aug 28 '24 19:08 cwaldren-ld

Thanks @cwaldren-ld! I confirm that with v7 it's no more there :tada: binaries will be smaller now.

gm42 avatar Aug 29 '24 16:08 gm42