Re:Bleve: full-text search and indexing for Go
by mschoch on Sunday January 07, 2018 @09:50AM
(#16091008)
You are correct. I think when I originally designed the homepage I wanted to show how you index and search in just a few lines. I thought omitting the error handling boilerplate was acceptable, but properly handling these errors is also key for a good initial experience. So I'm persuaded to at least revisit the decision.
https://github.com/blevesearch/blevesearch.github.io-hugo/is...
Re:Bleve: full-text search and indexing for Go
by yalue on Sunday January 07, 2018 @09:49AM
(#16091006)
It isn't common, and the code example wouldn't even compile because "err" is assigned but never used. I imagine that they included the "err" variables to show that they're available, but didn't want to clutter the example with error checks.
You can ignore error codes in go by assigning them to the special variable "_", but, outside of very short toy examples, it is a huge warning sign for terrible code. It's certainly not common to ignore errors in Go.
Re:Bleve: full-text search and indexing for Go
by roblaszczak on Monday January 08, 2018 @05:39PM
(#16101469)
for examples like this it is much better to explicit ignore error:
_ = index.Index(identifier, your_data)
it will also pass https://github.com/kisielk/errcheck check
eventually we can just panic error
if err := index.Index(identifier, your_data); err != nil { panic(err) }
Is that a common thing?