Is there documentation (or other) explaining why the main package must have 
name "main" and may not be imported? Is this an important simplification 
for the compiler?

I'd love it if a single "go get <url>" represented both my library root and 
my command line binary.

On Sunday, September 24, 2017 at 9:29:16 PM UTC-7, Ian Lance Taylor wrote:
>
> On Sun, Sep 24, 2017 at 5:33 PM,  <beac...@morris.umn.edu <javascript:>> 
> wrote: 
> > 
> > The fact that importing a main package in a non main-package isn't 
> supported 
> > ought to be in the Go spec. 
>
> Yes, probably.  Want to open an issue about it at https://golang.org/issue 
> ? 
>
> Technically, from the language perspective, I think the current 
> implementation forbids literally `import "main"`.  It permits 
> importing a package whose package name is "main", as long as a 
> different path is used to import it.  The go tool may impose other 
> restrictions--offhand I don't recall--but those restrictions, if any, 
> don't necessarily belong in the language spec. 
>
> Ian 
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to