Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: "cannot declare main" check erroneously applied to packages imported by main #24801

mdempsky opened this issue Apr 10, 2018 · 1 comment


Copy link

@mdempsky mdempsky commented Apr 10, 2018

$ cat a.go
package a

type main int

var X main

$ cat main.go
package main

import "./a"

func main() {
	a.X = 1

$ go tool compile a.go
$ go tool compile main.go
a.go:3: cannot declare main - must be func

This prevents from building with -l=4.


This comment has been minimized.

Copy link

@gopherbot gopherbot commented Apr 10, 2018

Change mentions this issue: cmd/compile: fix check that ensure main.main is a function

@gopherbot gopherbot closed this in 535ad8e Apr 10, 2018
@golang golang locked and limited conversation to collaborators Apr 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.