Skip to content

Development setup

This guide covers setting up your development environment for building and developing the DataRobot CLI.

Prerequisites

Installation

Installing Task

Task is required for running development tasks.

macOS

brew install go-task/tap/go-task

Linux

sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin

Windows

choco install go-task

Setting up the development environment

Clone the repository

git clone https://github.com/datarobot-oss/cli.git
cd cli

Install development tools

task dev-init

This will install all necessary development tools including linters and code formatters.

Build the CLI

task build

The binary will be available at ./dist/dr.

Verify the build

./dist/dr version

Available development tasks

View all available tasks:

task --list

Common tasks

Task Description
task build Build the CLI binary
task test Run all tests
task test-coverage Run tests with coverage report
task lint Run linters and code formatters
task fmt Format code
task clean Clean build artifacts
task dev-init Setup development environment
task install-tools Install development tools
task run Run CLI without building (e.g., task run -- templates list)

Building

Always use task build for building the CLI. This ensures:

  • Version information from git is included
  • Git commit hash is embedded
  • Build timestamp is recorded
  • Proper ldflags configuration is applied
# Standard build (recommended)
task build

# Run without building (for quick testing)
task run -- templates list

Running tests

# Run all tests
task test

# Run tests with coverage
task test-coverage

# Run specific test
go test ./cmd/auth/...

Linting and formatting

# Run all linters (includes formatting)
task lint

# Format code only
task fmt

The project uses:

  • golangci-lint for comprehensive linting
  • go fmt for basic formatting
  • go vet for suspicious constructs
  • goreleaser check for release configuration validation

Next steps