elastic / elastic/cloudbeat

testify mock linked in the final binary

Open
#3,598 2 comments 0 reactions 0 assignees View on GitHub
bug Team:Cloud Security
Dominant language
Go
Stars
58
Forks
55
Avg merge
9h 9m
Merged PRs (30d)
424

Description

**Describe the bug**

testify is a test dependencies and should not be used outside tests

The dependency is currently linked in the final binary.

I suspect this is caused by mocks being defined in non-test packages and in non-test files. The `github.com/stretchr/testify/mock.init` symbol is linked in the binary likely due to the import causing the call to the init method

**Preconditions**
Environment state and/or platform-specific configurations.

**To Reproduce**
Write the exact actions one should perform in order to reproduce the bug.
Steps to reproduce the behavior:
1. build cloudbeat
2. go version -m cloudbeat
3. observe testify in the dependency list

**Expected behavior**

testify is not included in the final binary

**References**
- https://www.dolthub.com/blog/2022-11-07-pruning-test-dependencies-from-golang-binaries/

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.