Hi,
I'm trying to put different code collection into the same Go source file, (from
here, if you want to know), because the knowledge is related thus better keep in one demo file instead of several. 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.,
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
}
In C#, this is not a problem at all, as I can just put different cases into different namespaces.
How to do it (putting different code collection into the same Go source file) in Go?
I tried to separate different sections with
but got the error
expected declaration, found 'package'
What's the easiest way to do it? please help.
Thanks