I'd like to make sure people aren't using Go 1.12 or older when compiling my application; mainly because this:
return fmt.Errorf("foo: %w", err) Will compile fine in Go 1.12, but won't actually behave as expected as it requires runtime changes in Go 1.13 or newer to pick up on that %w.
And even there are changes which introduce a compile error, such as binary literals or _ in numeric literals, a nicer "you need Go 1.13 or newer"-message would be better and less confusing, as not everyone may be familiar with Go and know what to do with a syntax error (it seems some people still use rather old Go versions).
I added go 1.13 to my go.mod file, but I can still compile it fine with older versions (and adding go 1.16 and compiling with Go 1.15 also works).
Is there any way to require a minimum Go version when compiling an app to prevent runtime errors and display a friendly error message?