Install Go agent with direct download
To download, build, and install the Go agent from a direct download, you can use the agent installer, or download the executable files manually.
Run the following command to run the agent installer:
go run github.com/contrast-security-oss/contrast-go-installer@latest latest
Alternatively, the contrast-go executables can be manually downloaded directly for Mac and Linux, on AMD64 and ARM64. To download the latest version, use the URL below that matches your operating system (GOOS) and architecture (GOARCH):
To download a specific version, or to script the download, use wget or curl. See available versions in go-agent-release. Replace <version> with the version number you want, or latest. Replace <goos>-<goarch> with darwin-amd64, darwin-arm64, linux-amd64, or linux-arm64.
Download the executable file from https://pkg.contrastsecurity.com using one of the following commands:
wget https://pkg.contrastsecurity.com/go-agent-release/<version>/<goos>-<goarch>/contrast-go
or
curl -L https://pkg.contrastsecurity.com/go-agent-release/<version>/<goos>-<goarch>/contrast-go > contrast-go
Then verify the agent is executable:
chmod u+x contrast-go
Build, configure, and run
Make sure the application is a Go module. If the application source directory has no
go.modfile, run the following command in that directory, replacing<module-path>with the path of your module:go mod init <module-path>
Build your application:
./contrast-go build -o output-name-of-application
Configure the Go agent. A connection token is the recommended method. Set
CONTRAST__API__TOKENin the environment where you run your application.You can also use other environment variables or the Go YAML template Go YAML template.
Run your application using the executable from the output above.
Verify the agent deployment
Interact with your application as you normally would. For example, interact with your application's web interface or send API commands.
In the Agent Wizard, select View agent activity to verify that your agent appears in the agents list.
Verify that you see the name of your application in the applications list.
In Northstar, select Applications from the left navigation.
In Contrast, select Applications from the header.
Verify that you see the name of your local server in the servers list.
In Northstar, select Servers from the left navigation.
In Contrast, select Servers from the header.