Re: [go-nuts] Re: directory name versus package name

2017-03-30 Thread Jan Mercl
On Thu, Mar 30, 2017 at 1:41 AM Dorival Pedroso 
wrote:

> I like the idea that the go tool would enforce matching directory and
package names.

I don't know why it should be enforced, but consider that commands must be
in package main.

-- 

-j

-- 
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.


[go-nuts] Re: directory name versus package name

2017-03-29 Thread Dorival Pedroso
I like the idea that the go tool would enforce matching directory and 
package names.

This would help us in case we forget to be consistent...

On Wednesday, March 29, 2017 at 5:18:52 PM UTC+10, Dorival Pedroso wrote:
>
> Hello,
>
> I haven't noticed that the code below (located at *$GOPATH/src/MyWrapper*
> ):
>
> package mylib
>
> import "fmt"
>
> func SayHello() {
> fmt.Println("hello")
> }
>
> is actually being installed (go install) as a *MyWrapper* package, even 
> though the package name was explicitly given as *mylib*.
>
> I couldn't find in the documentation where the handling of this situation 
> is described; i.e. how the final package name is decided (apparently the 
> directory name is chosen).
>
> Anyway, so, why using *package mylib* then?
>
> Cheers.
> Dorival
>
>
>

-- 
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.


[go-nuts] Re: directory name versus package name

2017-03-29 Thread Scott Lewis-Kelly
This is touched upon in this blog post 
. It is confusing that the 
import path would not match the package it contains. 

On Wednesday, March 29, 2017 at 6:18:52 PM UTC+11, Dorival Pedroso wrote:
>
> Hello,
>
> I haven't noticed that the code below (located at *$GOPATH/src/MyWrapper*
> ):
>
> package mylib
>
> import "fmt"
>
> func SayHello() {
> fmt.Println("hello")
> }
>
> is actually being installed (go install) as a *MyWrapper* package, even 
> though the package name was explicitly given as *mylib*.
>
> I couldn't find in the documentation where the handling of this situation 
> is described; i.e. how the final package name is decided (apparently the 
> directory name is chosen).
>
> Anyway, so, why using *package mylib* then?
>
> Cheers.
> Dorival
>
>
>

-- 
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.