Golang os/exec.LookPath() function example

package os

Golang os/exec.LookPath() function usage example

 package main

 import (
  "fmt"
  "os/exec"
 )

 func main() {
  path, err := exec.LookPath("dig")

  if err != nil {
 panic(err)
  }

  fmt.Println("Will be executing the binary at :", path)
 }

References :

http://golang.org/pkg/os/exec/#LookPath

Advertisement