mirror of
https://github.com/golang/go
synced 2024-11-14 23:30:27 -07:00
3aed92f811
Before this CL, defining the variable worked fine, but then when the implicit package-level init func was created, that caused a name collision and a confusing error about the redeclaration. Also add a test for issue 3705 (func init() needs body). Fixes #4517. R=ken2 CC=golang-dev https://golang.org/cl/7008045
10 lines
246 B
Go
10 lines
246 B
Go
// errorcheck
|
|
|
|
// Copyright 2012 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 p
|
|
|
|
var init = 1 // ERROR "cannot declare init - must be func"
|