goland os.Open 路徑錯誤

  os.Open 報錯原因:Open不是當前目錄下查找, 項目取的是項目根目錄,不是執行目錄:證明如下: exPath,_ := os.Getwd() fmt.Println("expath",exPath) file, err := os.Open(exPath+"/"+filename)   解決方法: 換成絕對路徑: 1. 設置output directory 和Working direc
相關文章
相關標籤/搜索