testify icon indicating copy to clipboard operation
testify copied to clipboard

This vet fix regressed Mock

Open brackendawson opened this issue 3 years ago • 1 comments

Summary

The attempt to fix a legitimate go vet finding (https://github.com/stretchr/testify/commit/b5ce16571001d6e96e1693ac891fed5c2510c651) breaks the referenced deprecated use case in v1.8.0. This vet finding can't be fixed until v2. The mutex is only copied when people use the deprecated case.

Changes

Revert invalid change from https://github.com/stretchr/testify/commit/b5ce16571001d6e96e1693ac891fed5c2510c651

Motivation

This caused a regression in v1.8.0 for people using a deprecated call to AssertExpectationsForObjects

Related issues

fixes #1227

brackendawson avatar Jul 22 '22 15:07 brackendawson

@brackendawson Could you improve the commit message and rebase?

dolmen avatar May 30 '25 16:05 dolmen

The simple revert by this PR is problematic because it fails vet, as the prior implementation did. There is no good way to fix this without failing vet. This was broken between v1.7.2 and v1.7.3. There has bee one user report of an issue since then in #1227. I think given the time since then and the lack of complaint it might be better to keep the unintended breaking change. But I can improve the panic by promoting the deprecation warning into a test failure, I'll do that in another PR.

brackendawson avatar Sep 15 '25 09:09 brackendawson