Skip to content

Latest commit

 

History

History
139 lines (95 loc) · 2.69 KB

File metadata and controls

139 lines (95 loc) · 2.69 KB

Development setup

This page outlines how to set up your development environment to build and develop with the DataRobot CLI.

Prerequisites

Installation

Install 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

Set 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

To 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 a coverage report.
task lint Run linters and code formatters.
task fmt Format code.
task clean Cleanly build artifacts.
task dev-init Set up a development environment.
task install-tools Install development tools.
task run Run the CLI without building (e.g., task run -- templates list).

Build the CLI

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

  • The version information from git is included
  • The git commit hash is embedded
  • The build timestamp is recorded
  • The 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 (both unit and integration)
task test

# Run tests with coverage
task test-coverage

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

Linting and formatting

For linting and formatting, this project uses the following tools:

  • golangci-lint for comprehensive linting
  • go fmt for basic formatting
  • go vet for suspicious constructs
  • goreleaser check for release configuration validation
# Run all linters (includes formatting)
task lint

# Format code only
task fmt

Next steps