This configuration was implemented on OpenSuse 42.2, Go1.8.1.linux-amd64, Visual Code, Git and Delve debugger
Install Go1.8.1.linux-amd64
1. Go can be installed by using YaST or you can download from here
2. Setting Environment with terminal
export GOROOT=/home/addies/golang/go
export GOPATH=$GOROOT/bin
export GOBIN=$GOROOT/bin
export PATH=$PATH:$GOROOT/bin
Test your installation by creating file hello.go and copy paste code below :
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
In your project folder, compile by using
cd /home/addies/golang/src/
go build
./hello
Result:
hello, world
Install Visual Code
1. Install Visual Code
2. Install Go plugin in Visual Code by pressing Ctrl + Shift + X and type lukehoban. After installed then restart your Visual Code to load the plugin
Install Delve Debugger
Open your terminal and Type command
go get github.com/derekparker/delve/cmd/dlv
Test installation by opening your hello folder project with visual code
1. Add break point by pressing F9
Pic 1. Add Breakpoint by pressing F9
2. Press Ctrl + Shift + D to enter debug mode
3. Press F5 to run in debug mode then visual code will stop at the break point
Please refer to picture as below for the debugging result:
Pic 2. Debugging result
You can Step Over with F10, Step Into with F11, Step Out with Shift + F11, Toggle Breakpoint with F9, Continue with F5 and add Watch variables.
That's it...
Thank you
Other Topics:
How to build NGINX RTMP module, Setup Live Streaming with NGINX RTMP module, Publishing Stream with Open Broadcaster Software (OBS), Create Adaptive Streaming with NGINX RTMP, Implementing Filtergraph in Streaming with NGINX RTMP, How to Implement Running Text in Streaming with NGINX RTMP, How to build OpenSceneGraph with Code::Blocks, How to build OpenSceneGraph with Visual Studio 2010, Building Geometry Model, How to run OpenSceneGraph with Netbean IDE 8.2 C++, Rendering Basic Shapes, Using OSG Node to Load 3D Object Model, Rendering 3D Simulator with OpenSceneGraph, How to compile wxWidgets with Visual Studio 2010, How to Setup Debugging in Golang with Visual Code
No comments:
Post a Comment