> However, the challenge to me is that, it keeps reusing the same
> variable name for different purposes (which I think IS good
> practice). E.g.,

For a blog or a tutorial that expands an example, this is fine. But it
is bad practice when designing a library.

> In one section the type A is defined as
> 
> type A struct { }
> 
> In another section the type A is defined as
> 
> type A struct { name string }

Why? If A has a name, why define A without it?

> How to do it (putting different code collection into the same Go
> source file) in Go?

You can't do that. An exported name A must be unique in a package.

Regards

Lutz

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to