On Fri, Nov 7, 2014 at 7:57 PM, <
rneer...@gmail.com> wrote:
> I don't see the need for trade off. The "go install" is already reading the
> package name from the top of file (and complaining if I have 2 files with
> main in same dir)
Go is opinionated, if you continue to fight it, you are going to have
a rather awful experience.
> Can it be made to write the output as filename instead of package name for
> such cases based on an option ?
Option soup is the opposite of being opinionated. That would be like
adding options to gofmt for various formatting flavors.
> I am not asking for any specific scenario to be supported. What I am doing
> is something I have seen at 10+ jobs sites I have been at.
Unless those 10 job sites where all pure Go, I think it is rather
irrelevant. Stop trying to make Go work like <other thing>. If you
like <other thing> just USE IT.
> This is the crux of my app and in various places I have worked at, this
> has been done in C or Java etc.
Again, irrelevant. I know it feels relevant, but it isn't. You
aren't using C or Java. When you travel, you follow the laws of the
country you are in -- you are in Go, do things the Go way.
> c) I have supporting cmds (or scripts). sc1, sc2.
> Lots of them . Small programs. Stand alone go lang code. Single
> file.
> For these, it seems overkill to create a dir per script. There will be
> 100s of them and it will be very inefficient to create 100s of dir with
> single .go file in them.
First of all, is directory creation really such a chore... seems like
a mountain of a molehill? Secondly, I can't fathom the situation you
are in that you want to create hundreds of binaries... heck, just
naming them would get confusing. clientapp99, clientapp114. I would
say the creation of directories is the LEAST of your problems if your
workflow requires the creation of hundreds of trivial scripts or
binaries. In my mind either: [1] you have hundreds of small, unique,
unrelated, specific use cases that are different enough to be
impossible to generalize or [2] you have an easily generalizable
problem and you just haven't solved it properly.
If the case is [1] then each one deserves its own directory, it is
really its own little application, with its own problem domain,
maintenance and solution. In the case of [2] (IMHO, far more likely)
you actually need to solve the problem in a more sane way then
generating (or writing by hand?!) hundreds of scripts.
> I have seen such scripts usually done in perl/python/curl
> here we are using golang for the program and scripting.
Again, I am unclear of what these "scripts" do, their complexity,
interdependency... but if you are writing hundreds of them, my gut
instinct is something has gone horribly wrong.
> If you say c) is not supported by golang, then I can evaluate writing them
> in different language.
> If you say I can write small scripts, but they each need a dir, I am back to
> "different language " option.
I think looking at different languages would be wise at this point. I
think you have a workflow you value more than the language (or your
sanity) you use, so it makes sense to switch your language rather than
you workflow.
> I find it hard to believe that no one is writing hundreds of stand alone
> small programs in golang?
I find it mind boggling that anyone would even consider that "normal"
-- or anything short of insane. Hundreds (plural)... my gosh, I have
been doing Go fulltime for over 18 months and have generated a handful
of binaries (maybe 35) and a lot of them are trivial implementations
of things like parallel downloaders, parallel console concurrency
(simpler than GNU parallel), log parsers, etc. I can't imagine how I
would end up with hundreds... again, I am very curious what is in
these programs that is entirely non-generalizable.