2012-02-16 21:50:37 -07:00
|
|
|
// errorcheck
|
2011-03-02 14:18:17 -07:00
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
2012-02-23 00:47:26 -07:00
|
|
|
// Verify that erroneous use of init is detected.
|
|
|
|
// Does not compile.
|
|
|
|
|
2011-03-02 14:18:17 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "runtime"
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2017-01-01 03:08:48 -07:00
|
|
|
init() // ERROR "cannot refer to init functions"
|
2011-03-02 14:18:17 -07:00
|
|
|
runtime.init() // ERROR "unexported.*runtime\.init"
|
2017-01-01 03:08:48 -07:00
|
|
|
var _ = init // ERROR "cannot refer to init functions"
|
2011-03-02 14:18:17 -07:00
|
|
|
}
|