Skip to content

Development setup

This guide walks you through setting up your environment to contribute to the ServiceNow SDK for Go. You can choose between a fully automated setup using Visual Studio Code Dev Containers or a manual local setup.

Prerequisites

Regardless of your setup choice, you need the following:

  • Git: For version control and cloning the repository.
  • ServiceNow Instance: A Personal Developer Instance (PDI) is essential for running integration tests. You can obtain one at no cost at developer.servicenow.com.

The easiest way to get started is using Visual Studio Code Dev Containers. This method automatically configures a consistent environment with all necessary tools (Go, linters, and extensions).

  1. Install Docker or Podman.
  2. Install the Dev Containers extension in Visual Studio Code.
  3. Fork and clone the repository:
    git clone https://github.com/YOUR_USERNAME/servicenow-sdk-go.git
    
  4. Open the folder in Visual Studio Code.
  5. Click "Reopen in Container" when the notification appears in the bottom right corner.

Option 2: Local development

If you prefer to manage your own environment, make sure you meet these additional requirements:

  • Go: Version 1.23 or higher.
  • golangci-lint: For running code quality checks.
  • just: (Optional) A command runner used for some development tasks.

Configure your environment

  1. Fork and clone the repository:
    git clone https://github.com/YOUR_USERNAME/servicenow-sdk-go.git
    cd servicenow-sdk-go
    
  2. Download dependencies:
    go mod download
    
  3. Install the linter: Follow the installation instructions at golangci-lint.run.

Configure environment variables

To run integration tests, you must configure your ServiceNow instance credentials. Create a .env file in the project root (git doesn't track this file):

SN_INSTANCE=your_instance_name
SN_USERNAME=your_username
SN_PASSWORD=your_password

Verify your setup

Run the unit tests to make sure your environment is working correctly:

go test ./...

Next steps

Now that your environment is ready, learn about the project architecture to understand how the project organizes the SDK.