LoginSignup
25
25

More than 1 year has passed since last update.

VSCode 用の launch.json でデバッグコマンドに環境変数 / 引数 / フラグを渡す設定

Last updated at Posted at 2017-04-19

環境変数を渡す

"env": {
    "FIRST_NAME": "yuma",
    "LAST_NAME": "inaura"
}

以下のような状態でコマンドが走ることになる。

FIRST_NAME=yuma LAST_NAME=inaura command

引数を渡す

"args": ["yuma","inaura"]

以下のようなコマンドが走ることになる。

command yuma inaura

コマンドのフラグを渡す

これも args に指定できる。

"args": ["--first_name=yuma","--last_name=inaura"]

以下のようなコマンドが走ることになる。

command --first_name=yuma --last_name=inaura

ファイル例

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "remotePath": "",
            "program": "${workspaceRoot}/some_package/cmd/name",
            "env": {
                "GOPATH": "/Users/yinaura/go",
            },
	        "args": ["yuma","--last_name=inaura"],
            "showLog": true
        }
    ]
}

環境

  • VsCode 1.11.2
  • MacOs Sierra 10.12.3

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

25
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
25