I have two variables in the scope of the package main , these will be the following:
var ( app Application cfg Config )
Now, as the size of my application starts to increase, I decided to put each module of the website in a separate package, very similar to a subdirectory:
/src/github.com/Adel92/Sophie + user/ (package user) - register.go - login.go - password.go + topic/ (package topic) - ... etc - main.go (package main)
How can I access the app and cfg global variables from other packages? Is this the wrong way? I have a feeling.
In this case, how would I declare functions in their own namespace so that I donβt have to go crazy with names that are constantly attached to user and topic .
source share