here the simple go application. I am getting "go run: cannot run non-main package" error, if I run following code.
package zsdfsdf
import (
"fmt"
)
func Main() {
fmt.Println("sddddddd")
}
to fix it, I just need to name the package to main.but i dont understand why I need to do that. I should be able to name the package whatever I want.
another question, I know main function is the entry point of the program, you need it. otherwise it will not work. but i see some codes that didn't have main function still works.
click on this link, the example at the bottom of the page didn't use package main and main function, and it still works. just curious why.
https://developers.google.com/appengine/docs/go/gettingstarted/usingdatastore
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Mon, May 26, 2014 at 3:45 PM, <john...@gmail.com> wrote:Go does not provide an automatic main package[0].
> I didnt know google provide main package and
> main function automatically.
I'm sorry if I may have written something implying that - even if I'm
not aware of it.