FAQ
A cookbook would be nice but this kind of stuff (a Fibonacci
function a little simpler than yours would be the perfect example)
should be in the documentation, too, IMHO. Something
like those 4 examples on the top for the sort package:

http://tip.golang.org/pkg/sort/

Il giorno mercoledì 17 giugno 2015 00:34:13 UTC+2, Michael Jones ha scritto:
I’ve written many (~100) little programs of this sort.

For big, for example, a Fibonacci tool and test suite:

Code: fibonacci.go
http://play.golang.org/p/An0BtNAsme

Tests: fibonacci_test.go
http://play.golang.org/p/DqpDtR2vT3

I’ve been thinking that we could have a “cookbook” for Go.


Michael Jones, CEO • mic...@wearality.com <javascript:> • +1 650
656-6989
Wearality Corporation • 289 S. San Antonio Road • Los Altos, CA 94022

On Jun 16, 2015, at 3:18 PM, alb.do...@gmail.com <javascript:> wrote:

I'm not OP, but I somewhat share his feelings.

Il giorno martedì 16 giugno 2015 23:06:15 UTC+2, Caleb Spare ha scritto:
In addition to what Ian said: if you want to be taught, that's what
things like https://tour.golang.org/ and http://blog.golif you want to
be taught, that's what
things like <http://blog.golang.org/>https://tour.golang.
<https://tour.golang.org/>ang.org/ <http://blog.golang.org/> are
for.
Yes, but the tour is very simple, and the blog doesn't cover everything:
it's simply no substitute for real code examples.

Take for example the math/big package. There's no mention of it in
the tour (obviously, it cannot cover every package in the standard
library), and there's no blog post about it.

Now what? The documentation is our last option. A 15-20 lines
code snippet that *does somethig real* would be tremendously
useful to someone that has never used math/big.Int. Something
that shows a whole *something* from start to end. A snippet where

a) you initialize a few big.Int (NewInt, etc.. )
b) you use operators on them (Add, Mul, Cmp)
c) you query Ints (Bits, Sign)
d) you print them (Format, ..)

But we don't have anything like that. A newcomer will have to settle for
this
example of the SetString( ) function:

i := new(big.Int)
i.SetString("644", 8) // octal
fmt.Println(i)


There's another one (4 lines) for Scan( ). And that's it.

This is virtually useless to someone that wants to start using the
math/big package. He'll have to google it hoping that someone
on stackoverflow.com has written a 15 lines complete example
that uses the package.

I, for one, appreciate that resources like the specification and the
stdlib docs are clear, concise, and precise, allowing me to quickly
locate the information I need. In fact, I much prefer Go's
documentation to any other language's that I've used.
I agree, but examples are hidden by default, and having better examples
won't bloat the documentation. It'll remain "clear and concise"

On Tue, Jun 16, 2015 at 1:04 PM, wrote:
Sorry to rant in my first post here, but my god, who killed the Golang docs?
Clearly this "documentation" style is intentionally idiomatic, but why?!?
The official docs @ https://golang.org/doc/ are categorically terrible.
Full-blooded examples are nearly extinct there. Why is it so hard for the
Go cult to write docs that TEACH instead of TELL?

I want to like Go, but it's really hard to forgive the needless amounts of
time it wastes when we have to tinker around for hours trying to get any
single task to work. There is simply no valid excuse for it.

It would do wonders for the language if the Go contributors could find it in
their hearts to clean up the minefields of the cratered landscape and plant
some real examples there instead. The failures outlined in this article
http://stevelosh.com/blog/2013/09/teach-dont-tell/ were frighteningly on the
nose, and I can only guess how much productivity has suffered.

</rant>

--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to golang-nuts...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

People

Translate

site design / logo © 2021 Grokbase