diff options
Diffstat (limited to 'loader')
-rw-r--r-- | loader/loader.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/loader/loader.go b/loader/loader.go index 9b46aa614..60d0f7eba 100644 --- a/loader/loader.go +++ b/loader/loader.go @@ -378,6 +378,12 @@ func (p *Package) Check() error { typeErrors = append(typeErrors, err) } checker.Importer = p + if p.Module.GoVersion != "" { + // Setting the Go version for a module makes sure the type checker + // errors out on language features not supported in that particular + // version. + checker.GoVersion = "go" + p.Module.GoVersion + } // Do typechecking of the package. packageName := p.ImportPath |