Mason's work following on the Go Writing Web Applications Tutorial
Use the following make commands in the root directory of the project
make: The default target, which is also available viamake help, lists the usage and available targetsmake clean: Thecleantarget will delete the existing Docker image if it existsmake build: Thebuildtarget will create a new Docker imagemake run: Theruntarget will start the application in a new containermake debug: Thedebugtarget will start the application in a new container in debug mode
Once the application is started, you can visit localhost:8080 to view the app
To debug the application in Visual Studio Code:
- Open
wiki.go - Place a breakpoint (anywhere is fine, you just need one placed before you start)
- Start the application (you can use the
makecommands listed above) - Create and start a launch configuration like the one below
- During debugging, do not disconnect or restart the debugger, otherwise you will need to restart the application to re-attach
{
"version": "0.2.0",
"configurations": [
{
"name": "Go Wiki",
"type": "go",
"request": "attach",
"mode": "remote",
"substitutePath": [
{
"from": "${workspaceFolder}/",
"to": "/go/src/gowiki/"
}
],
"port": 4040,
"showLog": true,
"apiVersion": 2
}
]
}