Live data from Hacker News

Executable Examples in Go

bitfieldconsulting.com

11–20 of 79 posts

Re: Executable Examples in Go

#12
post #6

Earlier quoted context omitted.

Are we looking at the same article? Its title quite clearly is “Go’s best-kept secret: executable examples” so the title here is only minorly editorialized.

It shows like that for me too now, but I am 100% sure this wasn't the case a few minutes ago. I copy/pasted the title.

[dead]

Re: Executable Examples in Go

#14
post #4

Earlier quoted context omitted.

I also like how the HN submitter changed the name of the programming language to "Golang". I guess they also call Ruby "ruby-lang" since they didn't get "ruby.org"?

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 too happy if someone submitted one of my articles and changed words like that, especially if it's to something I dislike. That's also why I complained about the editorializing in the first place, because I'd be a bit peeved if someone added something like "best-kept secret" in there (but the article title changed, so that's now a moot point).

Conversely, I'd also never change "golang" to "Go" when submitting something.

Re: Executable Examples in Go

#16
R has had this since at least 2000. The man pages for each function contain an "examples" block, and these are expected (but don't need) to be executable.

They then took it a step further a couple of years later going down the literate programming path with SWeave, and later Rmd.

Re: Executable Examples in Go

#17
post #11

Elixir has a similar concept with doc tests: https://elixir-lang.org/getting-started/mix-otp/docs-tests-a... You're comments/docs for the method can have demonstration code that is executed when you run your tests, ensuring your docs remain accurate. It's a great pattern.

I came here to say this and you beat me to it! Love this part of elixir. It's a good way to think about your functions: if you can't write a doc test, you've probably written a function with side effects.

Re: Executable Examples in Go

#19
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…

> I wouldn't be too happy if someone submitted one of my articles and changed words like that

gus_leonel appears to be a pseudonym for the author of the post. They have essentially no comments and most of their submissions are related to this Bitfield Consulting. So it's the author editorializing their own submission titles.

Re: Executable Examples in Go

#20
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…

I use Golang because Go is horrible to search for.

I also get into a habit of “Rust lang” because of the video game.

Yes, I could do a bunch of search engine customization stuff or pick someone else’s favourite engine. But this is simpler.

Post reply on HN