I would like to expose a function directly from a package.
So I could call my package directly instead of mypackage.Somepublic() method.

package main

import (
    "mypackage"
    "fmt"
)

func main() {
    var result = mypackage() 
    fmt.Println(result)    
}

In node.js, for example, you can expose a anonymous function

module.export = function() {
    console.log('ta da!');
}

or an object

module.export = {  
    doMagic: function() {  
        console.log('ta da!');
    }
};
go
Edit
Report