-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: update prerequiste and debug docs #6965
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a9bfd5f
docs: update prerequisite with dev container
lechnerc77 e392d53
docs: update debug guide
lechnerc77 8667df5
docs: md linting and typos
lechnerc77 908f9f9
docs: formatting of debig screenshots
lechnerc77 a3d41ec
Update docs/contributing/contributing-code/contributing-code-prerequi…
lechnerc77 afdc4ba
Update docs/contributing/contributing-code/contributing-code-prerequi…
lechnerc77 e2fe994
Merge branch 'radius-project:main' into docs/get-started
lechnerc77 412241a
docs: update structure after review
lechnerc77 be803b8
docs: fix image rendering
lechnerc77 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
Binary file added
BIN
+22.7 KB
...-code-first-commit/first-commit-04-debugging-cli/img/version-breakpoint-hit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+22.4 KB
...code-first-commit/first-commit-04-debugging-cli/img/version-with-breakpoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+155 KB
...t/first-commit-04-debugging-cli/img/vscode-debug-config-selection-with-args.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+175 KB
...irst-commit/first-commit-04-debugging-cli/img/vscode-debug-config-selection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+149 KB
...uting-code-first-commit/first-commit-04-debugging-cli/img/vscode-debug-pane.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+120 KB
...code-first-commit/first-commit-04-debugging-cli/img/vscode-debug-prompt-cmd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+86.3 KB
...mmit/first-commit-04-debugging-cli/img/vscode-debug-start-version-with-args.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+61 KB
...ting-code-first-commit/first-commit-04-debugging-cli/img/vscode-debug-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,67 +2,76 @@ | |
|
||
## Debugging your changes | ||
|
||
### Creating debug settings | ||
The following sections describe the debugging in Visual Studio Code (VS Code). If you are using another editor you can skip the following sections. | ||
|
||
You can debug your changes right from VS Code. It requires a small amount of set up for Go. | ||
>📝 **Tip** The first time you debug on **macOS** with a given version of Go you will be prompted to enter your password. It is normal for this to take 1-2 minutes for the prompt to appear the first time. | ||
|
||
First, open the [**Run View**](https://code.visualstudio.com/docs/editor/debugging#_run-view) in VS Code. You can do this either by clicking the icon or using the keyboard shortcut `shift+command+D` (`shift+control+d`) on Windows. | ||
## Predefined debug configurations | ||
|
||
<img width="300px" src="run-view.png" alt="Selecting the run view"> | ||
You can debug your changes right from VS Code. The repository has a `.vscode` directory which contains several launch configurations containing debugging configurations. We describe the configurations in the following sections. | ||
|
||
At the top of the new pane you should see something like the following: | ||
### Debugging rad CLI | ||
|
||
<img width="400px" src="options-in-run-view.png" alt="Opens in the run view"><br /> | ||
This section describes the configuration named **"Debug rad CLI"**. This is a basic Go debugger configuration that is set up to launch the `rad` CLI. To try it out, set a breakpoint in `main.go`. Set the breakpoint by clicking in the *gutter* to the left of the line numbers in you editor. Place the breakpoint on the new line you added in `main.go`. | ||
|
||
Click on `create a launch.json file`. | ||
<img src="img/main-with-breakpoint.png" alt="Placing a breakpoint in main.go" width="600" height="auto"> | ||
|
||
The debugger will stop the program prior to crossing over your breakpoint. Execute the following steps to launch the CLI in the debugger: | ||
|
||
This will open the file `.vscode/launch.json` in the editor. This is where VS Code stores information about different debugging configurations. | ||
- Open the debug pane. | ||
|
||
Replace the contents with the following text: | ||
<img src="img/vscode-debug-pane.png" alt="VS Code debug pane" width="600" height="auto"> | ||
|
||
```bash | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "rad CLI", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
"program": "${workspaceFolder}/cmd/rad/main.go", | ||
"cwd": "${workspaceFolder}", | ||
- Select the **"Debug rad CLI"** entry from the drop down list. | ||
|
||
// If you need to specify command line arguments | ||
// for the CLI they go here as a JSON array of strings | ||
"args": [] | ||
} | ||
] | ||
} | ||
``` | ||
<img src="img/vscode-debug-config-selection.png" alt="VS Code debug configuration selection" width="600" height="auto"> | ||
|
||
> This is a basic Go debugger configuration that is set up to launch the `rad` CLI. You can create definitions for any set of debug settings you want to keep handy. | ||
- Click the icon with the green triangle to launch the debugging session. | ||
|
||
### Running with the debugger | ||
<img src="img/vscode-debug-start.png" alt="VS Code start selected debug configuration" width="600" height="auto"> | ||
|
||
To try it out, first you should set a breakpoint in `main.go`. The debugger will stop the program prior to crossing over your breakpoint. | ||
Before the debugging will start the project is build in the background. This might take some time. After the build is completed the program will start and the breakpoint should be hit. | ||
|
||
Set a breakpoint by clicking in the *gutter* to the left of the line numbers in you editor. Place the breakpoint on the new line you added in `main.go`. | ||
<img src="img/main-breakpoint-hit.png" alt="Hitting a breakpoint in main.go" width="600" height="auto"> | ||
|
||
<img width="600px" src="main-with-breakpoint.png" alt="Placing a breakpoint"> | ||
You can play around with the various debugger features, like stepping into code. When you're done, hit the red square *stop* icon in the debugger tools to end the debugging session. | ||
|
||
> 📝 **Tip** - You can create definitions for any set of debug settings you want to keep handy. | ||
|
||
### Debug rad CLI - prompt for args | ||
|
||
This section describes the configuration named **"Debug rad CLI (prompt for args)"**. In contrast to the previous generic one this one uses the specific `rad CLI` commands to kick of the debugger. | ||
|
||
Let us test this setup by checking debugging the `rad version` command. The file is located at `cmd/rad/cmd/version.go`. Set a breakpoint at the beginning of the function `writeVersionString`: | ||
|
||
<img src="img/version-with-breakpoint.png" alt="Placing a breakpoint in version.go" width="600" height="auto"> | ||
|
||
The debugger will stop the program prior to crossing over your breakpoint. Execute the following steps to launch the CLI command in the debugger: | ||
|
||
Now you can launch the CLI in the debugger. Press `F5` to launch the debugger. Alternatively, you can click the icon with the green triangle in the *run view* to launch. | ||
- Open the debug pane. | ||
|
||
After some time the program will start and the breakpoint should be hit. | ||
<img src="img/vscode-debug-pane.png" alt="VS Code debug pane" width="600" height="auto"> | ||
|
||
>**macOS permissions** <br> | ||
The first time you debug on macOS with a given version of Go you will be prompted to enter your password. It is normal for this to take 1-2 minutes for the prompt to appear the first time. | ||
- Select the **"Debug rad CLI (prompt for args)"** entry from the drop down list. | ||
|
||
<img width="600px" src="main-breakpoint-hit.png" alt="Hitting a breakpoint"> | ||
<img src="img/vscode-debug-config-selection-with-args.png" alt="VS Code debug configuration selection with arguments" width="600" height="auto"> | ||
|
||
- Click the icon with the green triangle to launch the debugging session. | ||
|
||
<img src="img/vscode-debug-start-version-with-args.png" alt="VS Code start selected debug configuration with arguments" width="600" height="auto"> | ||
|
||
- The system will open up the command palette. Enter the command you want to debug i.e. `version` and confirm. | ||
|
||
<img src="img/vscode-debug-prompt-cmd.png" alt="VS Code debug command prompt" width="600" height="auto"> | ||
|
||
Before the debugging will start the project is build in the background. This might take some time. After the build is completed the program will start and the breakpoint should be hit. | ||
|
||
<img src="img/version-breakpoint-hit.png" alt="Hitting a breakpoint in version.go" width="600" height="auto"> | ||
|
||
You can play around with the various debugger features, like stepping into code. When you're done, hit the red square *stop* icon in the debugger tools to end the debugging session. | ||
|
||
## Next step | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is great 👍 |
||
- [Run tests](../first-commit-05-running-tests/index.md) | ||
|
||
## Related Links | ||
|
Binary file removed
BIN
-85.6 KB
...ibuting-code-first-commit/first-commit-04-debugging-cli/options-in-run-view.png
Binary file not shown.
Binary file removed
BIN
-17.9 KB
...-code/contributing-code-first-commit/first-commit-04-debugging-cli/run-view.png
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I previewed this in GitHub to verify that all of the images still work. Looks good 👍