Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. Go generates binary file for application when you do building with all the dependencies. This reduces the installing dependencies in runtime, and its easy to deploy the application.A single Go binary only supports the OS/architecture it was compiled for, but cross compilation is trivial. Using go routines you can easily call concurrent methods.
Open-source error tracking with full stacktraces & asynchronous context. Quickly find and fix production errors. Get notifications when errors occur or resurface. Better Error Tracking.
For development, you will only need Go installed in your environement. You can go to https://golang.org/ this site and install go.
If the installation was successful, you should be able to run the following command.
$ go version
go1.14.1
-
Go to this site and create a project https://sentry.io by seleting GO
-
You will get an sample code with your public dsn link in sentry
-
Secure that link for using in the project
import ( "github.com/gin-gonic/gin" sentry "github.com/getsentry/sentry-go" sentrygin "github.com/getsentry/sentry-go/gin" )
-
We are going to use gin framework for creating web server.
-
Define router and web server port in the main function.
-
Initialize the sentry in the router. Use the YOUR_PUBLIC_DSN key in Dsn argument.
-
You will get an error if sentry is not initialized properly.
-
As we are using gin, sentry has to integrated for all the routes in the application.
-
You can write a small function to test the error is capturing in sentry.