I have a use case where I’m using fmt.Sprintf in one package and importing it into another. The code builds successfully without errors, but I expected it to fail.
package a
func XYZ() {
.....
.....
log.Error(fmt.Sprintf("Failed to perform operation %s, error: %s", err.Error()))
}
package b
import "a"
....
Is it true that if code complies without errros, it means the function fmt.Sprintf doesn’t check the arguments at compile time and could throw a runtime error if the number of arguments doesn’t match? This is my understading but I may be wrong.