# How to Configure Local Development Mode with GO_MODERN_GUIDELINES_DEV=1

> Configure local development for JetBrains go-modern-guidelines by setting GO_MODERN_GUIDELINES_DEV=1. Load the CLI binary locally for faster iteration and debugging.

- Repository: [JetBrains/go-modern-guidelines](https://github.com/jetbrains/go-modern-guidelines)
- Tags: how-to-guide
- Published: 2026-09-04

---

**Set the environment variable `GO_MODERN_GUIDELINES_DEV=1` before launching your AI agent to force it to load the CLI binary from your local checkout instead of the released version.**

The `JetBrains/go-modern-guidelines` repository supports hot-reloading local changes during development through a dedicated environment flag. When enabled, agents like Junie, Claude Code, or Cursor execute the CLI from the cache directory at `~/.cache/go-modern-guidelines`, allowing immediate testing of modifications to [`internal/cli/cli.go`](https://github.com/JetBrains/go-modern-guidelines/blob/main/internal/cli/cli.go) without waiting for official releases.

## How GO_MODERN_GUIDELINES_DEV=1 Works

The local development mode intercepts the agent's normal binary resolution logic. Instead of downloading or referencing the production release, the agent checks for the presence of the `GO_MODERN_GUIDELINES_DEV` environment variable. When set to `1`, the system routes all CLI invocations to the cached binary built from your current working directory.

This mechanism relies on two components in the repository:

- **[`scripts/dev-install.sh`](https://github.com/JetBrains/go-modern-guidelines/blob/main/scripts/dev-install.sh)** – Compiles the local source and copies the binary into `~/.cache/go-modern-guidelines`
- **`Makefile`** – Provides the `dev-install` and `dev-uninstall` convenience targets that wrap the shell script

## Enabling Local Development Mode

Follow these steps to configure your environment for local development and testing.

### Build the Local CLI

First, compile the current checkout and install it into the cache directory. Run the provided Make target:

```bash
make dev-install

```

This executes [`scripts/dev-install.sh`](https://github.com/JetBrains/go-modern-guidelines/blob/main/scripts/dev-install.sh), which builds the binary from [`internal/cli/cli.go`](https://github.com/JetBrains/go-modern-guidelines/blob/main/internal/cli/cli.go) and places it in `~/.cache/go-modern-guidelines` where the agent can locate it.

### Export the Environment Variable

Before starting your AI agent, export the development flag in your shell:

```bash
export GO_MODERN_GUIDELINES_DEV=1

```

Ensure this variable is present in the process environment that launches the agent. You can verify it with:

```bash
echo $GO_MODERN_GUIDELINES_DEV

```

### Launch the Agent

Start your preferred agent while the environment variable is active:

```bash
junie

# Or: claude, cursor, codex, etc.

```

The agent now loads the CLI from your local cache instead of the official release binary.

## Iterating During Development

After modifying source files—such as those in [`internal/cli/cli.go`](https://github.com/JetBrains/go-modern-guidelines/blob/main/internal/cli/cli.go)—rebuild the cached binary to apply changes:

```bash
make dev-install

```

The next agent invocation automatically picks up the new build. This cycle allows rapid iteration without reconfiguring the environment, as the `GO_MODERN_GUIDELINES_DEV=1` flag remains set across terminal sessions until explicitly unset.

## Disabling Local Development Mode

To return to the released binary, either unset the environment variable or remove the cached build entirely.

Option 1: Unset the variable in your current session:

```bash
unset GO_MODERN_GUIDELINES_DEV

```

Option 2: Remove the cached binary using the Makefile:

```bash
make dev-uninstall

```

This deletes the local build from `~/.cache/go-modern-guidelines`, forcing the agent to revert to the standard release version on next launch.

## Summary

Configuring `GO_MODERN_GUIDELINES_DEV=1` enables rapid local development of the Go Modern Guidelines CLI by redirecting agent invocations to a cached binary built from source.

- **Build locally** using `make dev-install` to compile [`internal/cli/cli.go`](https://github.com/JetBrains/go-modern-guidelines/blob/main/internal/cli/cli.go) into `~/.cache/go-modern-guidelines`
- **Activate development mode** by exporting `GO_MODERN_GUIDELINES_DEV=1` before launching agents such as Junie or Claude Code
- **Iterate quickly** by rebuilding with `make dev-install` after each code change; the agent picks up changes immediately
- **Revert cleanly** by running `make dev-uninstall` or unsetting the environment variable to restore the released binary

## Frequently Asked Questions

### What does GO_MODERN_GUIDELINES_DEV=1 actually do?

When set to `1`, this environment variable signals the agent to bypass the released CLI binary and instead execute the version stored in `~/.cache/go-modern-guidelines`. This allows developers to test modifications to [`internal/cli/cli.go`](https://github.com/JetBrains/go-modern-guidelines/blob/main/internal/cli/cli.go) and other source files immediately without publishing a new release.

### Where is the local CLI binary stored?

The `make dev-install` command compiles the project and copies the binary to `~/.cache/go-modern-guidelines`. The [`scripts/dev-install.sh`](https://github.com/JetBrains/go-modern-guidelines/blob/main/scripts/dev-install.sh) script handles the actual file placement and permissions, ensuring the agent can locate and execute the cached build.

### Do I need to restart the agent after rebuilding?

No. The agent reads the binary from the cache directory on each invocation. After running `make dev-install` to update the cached build, the next request to the agent automatically uses the new code. You only need to restart the agent if you modify the environment variable itself.

### How do I verify the agent is using my local build?

Check that `GO_MODERN_GUIDELINES_DEV=1` is set in the agent's environment, then inspect the cache directory to confirm the binary timestamp matches your recent `make dev-install` execution. If the variable is unset or the cache is empty, the agent falls back to the standard released binary.