mirror of
https://github.com/golang/go
synced 2025-05-27 15:10:40 +00:00
gc: fix init of packages named main
This change removes the special case which existed for handling the initalization of the main package, so that other modules named 'main' get properly initialized when imported. Note that gotest of main packages will break in most cases without this. R=rsc CC=golang-dev https://golang.org/cl/4190050
This commit is contained in:
committed by
Russ Cox
parent
ff1d89d600
commit
daffc2d2ef
18
test/init.go
Normal file
18
test/init.go
Normal file
@ -0,0 +1,18 @@
|
||||
// errchk $G -e $D/$F.go
|
||||
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import "runtime"
|
||||
|
||||
func init() {
|
||||
}
|
||||
|
||||
func main() {
|
||||
init() // ERROR "undefined: init"
|
||||
runtime.init() // ERROR "unexported.*runtime\.init"
|
||||
var _ = init // ERROR "undefined: init"
|
||||
}
|
Reference in New Issue
Block a user