Go: Make diagnostics unit-testable and add test for EmitCannotFindPackages
#21214
+177
−40
EmitCannotFindPackages
#21214