IntelijIDEA (Goland) 使用 /private/var/folders/ (IntelijIDEA (Goland) uses /private/var/folders/)


問題描述

IntelijIDEA (Goland) 使用 /private/var/folders/ (IntelijIDEA (Goland) uses /private/var/folders/)

My Goland 的跑步者(運行/調試配置)在 os.Args[0] 中使用 /private/var/folders/7b/50mzg8x17q55rxfg3b0kpj88xcm2lx/T。我知道 os.Args[0] 是我的程序的路徑,但我可以將 os.Args[0] 作為我在 Goland runner 中的工作目錄嗎?

編輯配置中的PS工作目錄設置正確


參考解法

方法 1:

I know that os.Args[0] is the path to my program, but can I do os.Args[0] to be my working directory in Goland runner?

No, you cannot make os.Args[0] to be the working directory, since as you correctly identified, it's used to locate your program on disk.

There are two changes you can make:

  • change your code to stop relying on os.Args[0] and start using os.Getwd() to get the working directory. Then you can edit your Run Configuration via Run | Edit Configurations... | <name of the run configuration> | Working Directory parameter.
  • if you really want you binary to be in a certain directory, then you can go to Run | Edit Configurations... | <name of the run configuration> | Output directory to have the IDE run the compiler and place the executable wherever you need to.

If you need to make these changes for all future Run Configurations, then edit Run | Edit Configurations... | Templates | Go Build, or Go Test and change either the Working Directory or the Output Directory fields. Existing Run Configurations will not be changed.

(by KUKUdlsniper)

參考文件

  1. IntelijIDEA (Goland) uses /private/var/folders/ (CC BY‑SA 2.5/3.0/4.0)

#webstorm #goland #GO #macos






相關問題

找到 SASS 可執行文件的位置。(使用 rbenv) (Find the location of the SASS executable. (using rbenv))

如何在 webstorm 中使用 angular js (How to use angular js with webstorm)

Node 的 WebStorm 代碼完成顯示太多選項 (WebStorm code completion for Node shows too many options)

Webstorm JSX emmet 擴展 (Webstorm JSX emmet expansion)

無法在 node_modules (WebStorm) 中設置斷點 (Unable to set breakpoints inside node_modules (WebStorm))

Webstorm Meteor CSS 背景圖像位置 (Webstorm Meteor CSS Background Image Locations)

Webstorm 11 顯示有效代碼的編譯時打字稿錯誤 (Webstorm 11 shows compile-time typescript error for valid code)

WebStorm 和 TypeScript:如何導航到包的 JS 源文件? (WebStorm and TypeScript: how to navigate to JS source file of a package?)

有沒有辦法使用 WebStorm 中的調試器單步執行 RunJS 應用程序 (Is there a way to step through a RunJS app using the debugger in WebStorm)

IntelijIDEA (Goland) 使用 /private/var/folders/ (IntelijIDEA (Goland) uses /private/var/folders/)

無法將 WSL 節點解釋器添加到 WebStorm (Can't add WSL Node Interpreter to WebStorm)

禁止在 Nrwl Nx 的同一庫中導入桶文件 (Disallow barrel file imports within the same library in Nrwl Nx)







留言討論