0
1
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:
Gustavo Niemeyer
2011-03-02 16:18:17 -05:00
committed by Russ Cox
parent ff1d89d600
commit daffc2d2ef
4 changed files with 39 additions and 20 deletions

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"
}