You can add the functions to a map and use the string representation passed 
in from the command line to execute them

var funcs map[string]func()

func add(){
  ... get parameters from command line
}

func main(){
  func, ok := funcs[funcName]
  ... test ok

  func()
}

On Thursday, 21 July 2016 12:14:04 UTC-7, christ...@google.com wrote:
>
> Cgo enables us to call C functions from Go programs, and we can run C 
> functions from command line.
>
> Are we able to call Go functions directly from command line?
>
> For example if I have a function in Go:
>
> func add(a, b int) int {
>   return a + b
> }
>
> Can I somehow invoke this from bash?
>
>
>
> Thanks!
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to