Install the Go agent with direct download

To install the Go agent:

  1. Download both of the executable files from https://pkg.contrastsecurity.com.

    The contrast-go and contrast-service executables can be downloaded directly for Mac and Linux operating systems. You can see available versions in the contrast-service-release and go-agent-release user interface. Replace <version> with the version number you want, or latest.

    • For Mac:

      wget https://pkg.contrastsecurity.com/contrast-service-release/<version>/darwin-amd64/contrast-service
      wget https://pkg.contrastsecurity.com/go-agent-release/<version>/darwin-amd64/contrast-go

      or

      curl -L https://pkg.contrastsecurity.com/contrast-service-release/<version>/darwin-amd64/contrast-service > contrast-service
      curl -L https://pkg.contrastsecurity.com/go-agent-release/<version>/darwin-amd64/contrast-go > contrast-go
    • For Linux:

      wget https://pkg.contrastsecurity.com/contrast-service-release/<version>/linux-amd64/contrast-service
      wget https://pkg.contrastsecurity.com/go-agent-release/<version>/linux-amd64/contrast-go

      or

      curl -L https://pkg.contrastsecurity.com/contrast-service-release/<version>/linux-amd64/contrast-service > contrast-service
      curl -L https://pkg.contrastsecurity.com/go-agent-release/<version>/linux-amd64/contrast-go > contrast-go
  2. After download, verify that the agent and service are executable. For example:

    chmod u+x contrast-service
    chmod u+x contrast-go
  3. Be sure the application has a go.mod file to indicate required dependencies. In the application source directory run the following command:

    go mod init
  4. Build your application:

    contrast-go build -o output-name-of-application
  5. Configure the Go agent using the Go YAML template or environment variables.Configure the Go agentGo YAML template

  6. Install and run the Contrast service through the command: ./contrast-service.Install the Contrast service

  7. Run your application using the executable from the output above.

  8. Exercise and test your application.

  9. Verify that Contrast sees your application.