func getCurrentPath() string {
    s, err := exec.LookPath(os.Args[0])
    checkErr(err)
    i := strings.LastIndex(s, "\\")
    path := string(s[0 : i+1])
    return path
}

func checkErr(err error) {
    if err != nil {
        panic(err)
    }
}

 法二:

apath, _:=os.Getwd()
fmt.Println(apath)
fp := http.FileServer(http.Dir(apath+"/pdfjs/"))

 

相关文章:

  • 2021-12-08
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-23
  • 2021-12-20
  • 2021-12-01
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
相关资源
相似解决方案