Go Integration¶ This page contains details on how to properly integrate your Go software with the Go agent. Feel free to contact us if you don't find the details you need in this page. Blocking Protections¶ Blocking protections are attached to Go functions, and leverage the Go error-handling and context-propagation principles in order to properly block a request. When blocking a function call, Sqreen: Cancels the request context in order to propagate the request cancellation. Serves the request with the blocking behavior configured in the settings page. And finally aborts the function call by returning an error of type SqreenError. Aborting the request handler¶ The request handler should be immediately aborted when a function it uses returns a non-nil error. If required, the error can be bubbled-up to return from every calling function up to the request handler. For finer-grained error management, it is possible to test if the error has type SqreenError by using the Go function errors.As(). See https://godoc.org/github.com/sqreen/go-agent/sdk/types for more details. Note that Sqreen automatically handles the HTTP response according to your app settings at https://my.sqreen.com/application/goto/settings/global. Aborting request sub-operations and goroutines¶ When blocking a request, Sqreen cancels the request context in order to signal the request cancellation and abort every sub-operation and goroutine the request handler may have started. Every handler sub-operation, such as an SQL query, should be given the request context in order to be immediately canceled when Sqreen cancels the context.