Re: [go-nuts] Re: Multi-word Project Name

2021-04-29 Thread Brian Candler
Sure. In the OP's given path "github.com/username/sherlock-server", if it provides either "package sherlock" or "package server" it's not too bad. Thanks for pointing me to goimports. That does indeed rewrite the example as import ( "fmt" foo "example.com/my/module/with-a-very-weird-name" )

Re: [go-nuts] Re: Multi-word Project Name

2021-04-29 Thread 'Axel Wagner' via golang-nuts
Note that goimports theses days adds the package name explicitly to the import if the package name is not identical to the last component of the import path. So on the readability front, the cost seem pretty low to me. It does have a cost on the writing side, as goimports might not find the packag

Re: [go-nuts] Re: Multi-word Project Name

2021-04-29 Thread Brian Candler
P.S. I don't really recommend this, since you can't tell by inspection of main.go which import provides "foo.Greeting". And I'm struggling to think of any real-world examples where I've seen this used. -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Re: Multi-word Project Name

2021-04-29 Thread Brian Candler
> Guess by "even if it wasn't" you mean "even if it wasn't top level and was exporting functionality" I think he means in general, you can do this: // go.mod says "module github.com/my/module/with-a-very-weird-name" package foo ... and when you import it, you still get a package "foo". That's

Re: [go-nuts] Re: Multi-word Project Name

2021-04-28 Thread iammadab
Assuming by package name your mean package "packagename" and import path import "importpath" Guess by "even if it wasn't" you mean "even if it wasn't top level and was exporting functionality" but don't quite understand what you meant On Wednesday, 28 April 2021 at 21:47:15 UTC+1 axel.wa...@goo

Re: [go-nuts] Re: Multi-word Project Name

2021-04-28 Thread 'Axel Wagner' via golang-nuts
FWIW the package name doesn't *have* to be the same as the import path. So even if it wasn't, you could name the package something else and still use that import path. Otherwise, there would be the option to use `_`, which is valid inside an identifier. On Wed, Apr 28, 2021 at 10:40 PM iammadab w

[go-nuts] Re: Multi-word Project Name

2021-04-28 Thread iammadab
Apparently, because it is a top level module and it won't be exporting anything it is actually fine. Thanks. On Wednesday, 28 April 2021 at 21:18:16 UTC+1 seank...@gmail.com wrote: > Yes that can be your module name, it won't affect much > > On Wednesday, April 28, 2021 at 10:14:55 PM UTC+2 iamm

[go-nuts] Re: Multi-word Project Name

2021-04-28 Thread Sean Liao
Yes that can be your module name, it won't affect much On Wednesday, April 28, 2021 at 10:14:55 PM UTC+2 iammadab wrote: > Hi, I have a github repository name (sherlock-server) of which I have > found no one word description that captures the essence. > > Can I name the module github.com/usernam