Live data from Hacker News

Executable Examples in Go

bitfieldconsulting.com

21–30 of 79 posts

Re: Executable Examples in Go

#21
post #14

Earlier quoted context omitted.

Golang is a common way to refer to Go, especially for SEO purposes. “Go” is hard to search for. https://go.dev/doc/faq#go_or_golang I use “golang” for clarity all the time, and I’m sure many others do as well. There’s no ambiguity you’re talking about the language then.

I personally strongly prefer to use Go, and would never use "golang" or "Golang", but I don't mind if other people do and I'd never complain about it. The reason for this is simply that I don't like the sound of the word "golang"; there are some other words I avoid for similar reasons, I think everyone has a few of those. The thing is that the article title uses Go while the submission here uses Golang. I wouldn't be…

Based on the submitter’s posting history and change in original article title, I’m going to go on a limb and say that the submitter is the original author.

Yeah, the names don’t match, but out of all of the things they submitted, at least half are articles from this site.

But beyond that, I mean, does it matter? You might not appreciate it, sure, but you’re also not the original author. I’d get the argument if the author came in and said it, but at this point this just seems like complaining for complaining’s sake and you not agreeing with the phrasing used in the article or submission title. That’s certainly your opinion to have, but is there any benefit to expressing it? This doesn’t seem like a relevant discussion about the article contents.

Re: Executable Examples in Go

#23
post #14

Earlier quoted context omitted.

Golang is a common way to refer to Go, especially for SEO purposes. “Go” is hard to search for. https://go.dev/doc/faq#go_or_golang I use “golang” for clarity all the time, and I’m sure many others do as well. There’s no ambiguity you’re talking about the language then.

I personally strongly prefer to use Go, and would never use "golang" or "Golang", but I don't mind if other people do and I'd never complain about it. The reason for this is simply that I don't like the sound of the word "golang"; there are some other words I avoid for similar reasons, I think everyone has a few of those. The thing is that the article title uses Go while the submission here uses Golang. I wouldn't be…

Your preferences/likes/dislikes are irrelevant. "Golang" is a official way to refer to the Go language.

Re: Executable Examples in Go

#25
post #23
post #14

Earlier quoted context omitted.

I personally strongly prefer to use Go, and would never use "golang" or "Golang", but I don't mind if other people do and I'd never complain about it. The reason for this is simply that I don't like the sound of the word "golang"; there are some other words I avoid for similar reasons, I think everyone has a few of those. The thing is that the article title uses Go while the submission here uses Golang. I wouldn't be…

Your preferences/likes/dislikes are irrelevant. "Golang" is a official way to refer to the Go language.

I explicitly said that it's fine to use golang. I am saying I don't like people changing my words, which is entirely reasonable and a very different argument than "never use golang".

Re: Executable Examples in Go

#26
Adding to the list of languages that also have this: python. Unfortunately searching on google "python executable comments" only returns lobotomized results about what comments in python are.

Re: Executable Examples in Go

#27

Adding to the list of languages that also have this: python. Unfortunately searching on google "python executable comments" only returns lobotomized results about what comments in python are.

"doctests" is the name used in the python world

Re: Executable Examples in Go

#28
Ok, this is indeed a very well kept secret. I have been programming go for a really long time, and was even a readability reviewer at Google, and I had no idea. Thank you, OP.

Re: Executable Examples in Go

#29
post #14

Earlier quoted context omitted.

I personally strongly prefer to use Go, and would never use "golang" or "Golang", but I don't mind if other people do and I'd never complain about it. The reason for this is simply that I don't like the sound of the word "golang"; there are some other words I avoid for similar reasons, I think everyone has a few of those. The thing is that the article title uses Go while the submission here uses Golang. I wouldn't be…

Based on the submitter’s posting history and change in original article title, I’m going to go on a limb and say that the submitter is the original author. Yeah, the names don’t match, but out of all of the things they submitted, at least half are articles from this site. But beyond that, I mean, does it matter? You might not appreciate it, sure, but you’re also not the original author. I’d get the argument if the au…

> I mean, does it matter? You might not appreciate it, sure, but you’re also not the original author.

Well, no, but I'd rather not assume anything: just let the author pick the title.

(I assumed that "gus_leonel" wasn't the author, since John Arundel has his own HN account under his regular "bitfield" username, but they do post a lot from bitfieldconsulting, so idk).

Re: Executable Examples in Go

#30
Python also has doctest https://docs.python.org/3/library/doctest.html since ... a long time now.

The documentation tools are not as advanced as Go's and as far as I know, there's no way to "run the examples" yourself.

It's a great way to write tests for some functions though, to me the sweet spot is for small, without side effects functions. It's totally possible for bigger functions but then all the initialization code and assertions can easily get in the way and make the documentation not super clear.

Post reply on HN