Answers for "golang get location of executable"

Go
0

golang get location of executable

package main

import (
    "github.com/kardianos/osext"
    "fmt"
    "log"
)

func main() {
    folderPath, err := osext.ExecutableFolder()
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(folderPath)
}
Posted by: Guest on February-11-2021

Browse Popular Code Answers by Language