I was using tt.Error(fmt.Sprintf("...", ...))
in many places around my go test scripts, then I realized there’s a more elegant way, tt.Errorf("...", ...)
I want to do a global search and replace, and the easiest way would be to use regular expression to match both sides of the quote. Great to know that this is indeed an option if I do:
- Search for
Error\(fmt.Sprintf\((.+)\)\)
- Replace with
Errorf\($1\)
The VS code documentation listed more examples: