The sample code:
// main.go in varglobal/
package main
import(
"fmt"
"varglobal/db"
)
var MyGlobalVar string ="Any value :)"
func main(){
db.TryDisplayMyVar()
}
// db.go in varglobal/db/
package db
import "fmt"
func TryDisplayMyVar(){
fmt.Println("Val
On Fri, Nov 16, 2018 at 2:40 PM Juan Mamani
wrote:
> Why can not access global var MyGlobalVar? Any idea?
Go has no global scope. It has universe scope, but you cannot define
anything there. `MyGlobalVar` has package scope. To access an exported
identifier imported from pacakge foo, you must use
Thanks for comments.
Good idea is to implement "package qualifier". I will try it.
(Conclusion: Go's rule doesn't apply for subdirectories. If I'm wrong let
me know=)
Thanks again!
El vie., 16 de nov. de 2018 a la(s) 10:53, Jan Mercl (0xj...@gmail.com)
escribió:
>
> On Fri, Nov 16, 2018 at 2