
Hello Go - caspervonb
https://medium.com/@caspervonb/hello-go-3e207da92da0
======
ktpsns
> Note: If you are on Microsoft Windows without a UNIX like environment you
> might want to re-evaluate your life choices at this moment.

Great sentence! However, Powershell got quite mature. `cat -n` is definetly
something you will be able to do in Powershell with a similarly lengthy
command.

~~~
AskewEgret
Of course. Get-Content puts every line of text into the pipeline as a .Net
String object with a few additional attributes added on, including ReadCount
which is the line number. For example:

Get-Content -Path TEXT.TXT | %{"$($_.ReadCount) $($_.Length) $($_.ToUpper())"
}

For each line of text, this will print the line number, the length of the
string, and the string converted into upper case.

PowerShell is very wordy, but very powerful.

~~~
Cthulhu_
I'm neither a sh nor powershell guru, but, it kinda feels like that Powershell
was intended more as a scripting language, less as a commandline language. sh
/ bash / etc commands are more terse, but harder to read if they're composed
into a shell script.

I mean I still can't wrap my head around [ being a command / executable usable
in conditions.

~~~
AnIdiotOnTheNet
Since shell languages invariably end up becoming scripting languages (see:
Bourne shell and resulting nightmare), Powershell targets being a good tool
for both purposes.

When scripting and writing documentation, full commandlet names are
encouraged:

    
    
      Get-ChildItem | Where-Object { $_.Name.Contains("evidence") } | Remove-Item
    

When using the command line, there are built-in shortcuts (and users may
define their own aliases):

    
    
      gci | ?{ $_.name.contains("evidence") } | ri
    

For the convenience of those hopelessly entrenched in Bourne shell, there are
some default aliases:

    
    
      ls | ?{ $_.name.contains("evidence") } | rm

~~~
stcredzero
_Since shell languages invariably end up becoming scripting languages_

We need to start paying attention to this phenomenon.

------
jimktrains2
Perhaps I've never hit the problems that go solves? I just don't understand
why I'd learn it when it offers nothing new or unique and feels even more
clunky to work in than alternatives.

Specifically for me, I know enough poorly-typed lanagues that I want to be
learning and using languages that offer me a good type system to express my
program in, and not just jump through hoops to get things to work with no
large benefit or reduction in code (and do when I get a chance).

I get coroutines are cool, but they don't really seem to solve the problems I
have with concurrency. They feel like baked-in message queues.

~~~
systems
well, the ecosystem is usually the answer, Go is a simple language, which
attracted many developers, which resulted in a large ecosystem

but there is also the issue of complexity developer used Go to create complex
systems, because it is a simple language, it allowed them to focus on the
solution

while, complex systems, might be simpler if they were built using complex
languages, it seems most developer prefer to build complex systems using
simple languages, rather than build simple systems using complex languages

complexity doesn't disappear you can only spread it around, to make it more
manageable .. using a simple language and moving complexity to the solution,
seems like a trade off many are willing to make .. so this is not necessarily
a bad thing .. its a preference

if Go starts adding complex features, many developers will move or chose
another language ..

~~~
parenthephobia
> it seems most developer prefer to build complex systems using simple
> languages, rather than build simple systems using complex languages

According to TIOBE, 1% of programmers are using Go, whilst 23% are using Java
or C++.

If that is to be believed, developers do not appear to prefer simple
languages. Or, Java and C++ are simple languages. Or, language selection is
not based on preference.

~~~
systems
well while many question TIOBE, i believe a lot fewer will question the
empirical observation that C# and Java are bigger in the job market than C++

C# and Java both are a lot simpler than C++

i would even argue that by adding more features into Java and C#, a door was
opened to PHP, Python, Ruby and now GO

i still stand by conclusion, that most developer prefer to move complexity to
the solution and away from the language

and to be clear, i saying that this is a preference and taste issue, i am not
saying that one is better than the other, i am not even saying that developers
who prefer complex languages have bad taste ... it is just the way it is ...
others have expressed it in more length

[https://www.jwz.org/doc/worse-is-better.html](https://www.jwz.org/doc/worse-
is-better.html)

~~~
pjmlp
Simple languages like Go just put the burden of complexity on the shoulders of
developers, that end up implementing ad-hoc solutions for what other languages
support natively.

Hence how we end up with factory-factory classes, aspect oriented programming,
patterns and stuff.

On Go's case, how we now have n variants of code generation libraries or
multiple solutions to sort out dependencies and vendoring.

GoSpring and GoEE, similar to Java 1.2 days, should be quite interesting to
see.

------
shekhar101
Slightly OT, but I really want to learn golang but the amount of available
resources[0] makes it quite overwhelming. I don't want to learn simple stuff
but also want to go along the basics and learn good coding practice and design
patterns. Any recommendations? What's your favorite resource for learning
golang that helped you the most? [0]:
[https://github.com/golang/go/wiki/Learn](https://github.com/golang/go/wiki/Learn)

~~~
DisownedWheat
Honestly the Tour of Go on their site is pretty good for just diving into it.
You can probably just skim the first few chapters just to get familiar with
the syntax.

[https://tour.golang.org/welcome/1](https://tour.golang.org/welcome/1)

------
jhoechtl
Did I miss something or does this article end without coming to a conclusion?

So let's do the authors work: What is the conclusion to be drawn here?

~~~
caspervonb
That we should edit wikipedia and add "gopher sort" to bogo sort's list of
names?

Had planned more, each section getting more silly than the previous including
a tangent where it evolved into Hello as a Service but for now, to be
continued.

------
vijaybritto
But coroutines are not threads right? Multiple coroutines can run on the same
thread isnt it?

I find it confusing when coroutines are interchanged between concurrency and
parallelism.

~~~
caspervonb
Concurrency does not equal parallelism.

Lets say there's one core, or "hardware thread". Then the scheduler has no
choice but to stick them all on the same thread. They are running concurrently
but not in parallel.

With more cores, Go can schedule them to run in parallel.

Rob Pike has a great talk on YouTube titled something like "Concurrency is not
parallelism" on this exact thing.

~~~
dpflan
Indeed, taken from "Go Proverbs" \- [https://go-
proverbs.github.io/](https://go-proverbs.github.io/)

"Concurrency is not parallelism."

> Video:
> [https://www.youtube.com/watch?v=PAAkCSZUG1c&t=3m42s](https://www.youtube.com/watch?v=PAAkCSZUG1c&t=3m42s)

------
millstone
That rand.Shuffle interface looks pretty nice; why wasn't that used for sort?

~~~
skj
Because instead of one special function (swap) it needs two (swap and
compare), and the two refer to the same data. So, put that data in a struct
and give it methods.

------
AngeloAnolin
Fastest way to get around the paywall on this article is by right clicking on
the link and selecting:

Chrome: Open Link in Incognito Window

FF: Open Link in New Private Window

These are the browsers I used generally.

------
ngrilly
Are we supposed to share articles behind paywalls on HN?

Edit: I wasn't aware of the entry in HN's FAQ related to paywalls. See
comments below.

~~~
caspervonb
From the FAQ:

> It's ok to post stories from sites with paywalls that have workarounds.

> In comments, it's ok to ask how to read an article and to help other users
> do so. But please don't post complaints about paywalls. Those are off topic.

For Medium, this means just blocking or deleting the cookie.

~~~
ngrilly
I know how to workaround the paywall by blocking or deleting the cookie :-)
But I wasn't aware of this entry in HN's FAQ. I disagree, but if this is the
rule on HN, then I'll follow it. Thanks for your reply.

------
nikivi
I think Medium premium stories should be at least marked as such in the title.

I also think it's quite absurd marking personal articles as 'pay to read'.

~~~
ccccccccccccc
I chuckle a bit thinking of someone paying a monthly subscription to read
"Hello World" articles

~~~
caspervonb
But it's with bogo sort..!

Anyhow the goal was to elicit a chuckle, so even if its not directly from the
post I'll still count this as a success.

