Using node.js, we might have this:
const z = new Z();
exports.z = z
and then in another file we can import
import {z} from '../z'
with Golang, I am trying to do something similar:
package log
// create an instance
var log = Logger.create()
// export the methods
var Info = log.Info
var Warn = log.Warn
var Error = log.Error
and then we import it like
func init(){
log.Info("something")
log.Warn("something")
}
/// ===========
basically what I am asking is if there is a way to create an instance and access it's methods - so that in my code I don't have to do:
but instead I can do:
log.Info()
hope the question makes sense.