stackconf 2024 - IGNITE: Swiss knife for Go debugging with VSCode by Ivan Presenti.pdf
NETWAYS
7 views
20 slides
Jul 25, 2024
Slide 1 of 20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
About This Presentation
Being able to debug your code in the IDE should be an easy process. If you ever struggled with debugging Go code in Visual Studio Code, this session is definitely for you. We’ll take a look at how to debug several kinds of projects by only tweaking settings in the dreaded “launch.json” file. Y...
Being able to debug your code in the IDE should be an easy process. If you ever struggled with debugging Go code in Visual Studio Code, this session is definitely for you. We’ll take a look at how to debug several kinds of projects by only tweaking settings in the dreaded “launch.json” file. You’ll discover how many options and customizations you can apply to this file to leverage your debugging experience. Finally, we briefly touch on the key features of the Delve debugger.
Size: 2.23 MB
Language: en
Added: Jul 25, 2024
Slides: 20 pages
Slide Content
@ossan
Swiss Knife for Go
Debugging with VSCode
Ivan ossan Pesenti
Software Developer
StackConf 2024
1
@ossan
Why Debugging?
Get more familiar with the codebase you’re working with. Follow the execution
path to find out functions invoked.
Find out where bugs happen and fix them. Allow you to slow down the code
execution in specific parts to dig into them.
Inspect variables’ values or complex objects and how they change while code
execution.
Codebase Knowledge
Detect Bugs
Inspection
2
@ossan
What Debugging?
01
0504
02
06
03
Unit Test
Functions.
Microservices-base
d apps.
Benchmark
Functions.
Integration Test
Functions.
Any piece of code
in your mind.
Command Line
Interface Apps.
3
@ossan
Delve in a Nutshell
●The debugger for Go programs
●Part of the Go tools
●Can be also installed outside of Visual Studio Code
●Listen to commands through a CLI tool
●Provide debugging capabilities outside of a regular IDE
4
@ossan
The “settings.json” File
●Home for all VS Code settings
●Every setting in User Preferences (GUI) can be found here
●Editor’s behavior, themes, extensions’ settings, keyboard shortcuts, etc.
●Boost developers productivity and consistency
●Allow to apply different settings based on the opened project (User VS Workspace)
5
@ossan
Go With the dlv-dap (not legacy)
6
@ossan
The “launch.json” File
7
@ossan
launch.json Configurations
●Selectable in Run View menu
●Holds a specific configuration
to test, debug, launch, etc. a
specific piece of code
●Different for each scenario
●Prepares the input for Delve
8
@ossan
Debug Unit Test
9
@ossan
Debug Integration Test
10
@ossan
Debug
Integration Test
11
@ossan
Attach to Process
12
@ossan
Attach to Process
13
@ossan
Compound Configuration
14
@ossan
Compound Configuration
15
@ossan 16
@ossan
Debug StdIn
17
@ossan
Global Variables
18
@ossan
Debug Console Evaluation
19
@ossan
Thanks
05
20
t.ly/pDNHV
QR code and Link to the repository