Groups
Groups
Sign in
Groups
Groups
golang-nuts
Conversations
About
Send feedback
Help
go build current weekly gives: runtime.main: undefined: main.init. Direct 6g/6l is fine.
1,072 views
Skip to first unread message
gmallard
unread,
Feb 10, 2012, 8:10:05 PM
2/10/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Hi. I have a very strange problem with a very simple sample program.
Running 'go build' gives me:
[gmallard@tjjackson switch_test (swwork)]$ go build
# go-samp/switch_test
runtime.main: undefined: main.init
runtime.main: undefined: main.main
Running a direct compile and link is fine:
[gmallard@tjjackson switch_test (swwork)]$ $GOROOT/bin/tool/6g
switch_test.go
[gmallard@tjjackson switch_test (swwork)]$ $GOROOT/bin/tool/6l
switch_test.6
[gmallard@tjjackson switch_test (swwork)]$ ./6.out
Start...
Dunno
End...
Here is the code:
package main
import (
"fmt" //
)
func main() {
fmt.Println("Start...")
anint := 256
switch anint {
case 1:
fmt.Println("Is 1")
case 2:
fmt.Println("Is 2")
case 3:
fmt.Println("Is 3")
default:
fmt.Println("Dunno")
}
fmt.Println("End...")
}
For reference:
[gmallard@tjjackson switch_test (swwork)]$ go version
go version weekly.2012-02-07 +52ba9506bd99
It is perplexing, because I have spent the greater part of today
converting a number of programs from 'make' to 'go' builds. All else
looks good.
Thanks, Guy
gmallard
unread,
Feb 10, 2012, 8:51:45 PM
2/10/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Solution: do not name normal files with _test at the end of the file
name.
Thanks Rémy and Dave.
Reply all
Reply to author
Forward
0 new messages