# Go: cannot refer to unexported name pkg.helper (undefined: pkg.helper)

**Code:** `cannot refer to unexported name` · **Category:** Go · **Seen on:** Go

You used a lowercase (unexported) identifier from another package; only capitalised names are visible outside their package.

## Meaning

Rename the identifier to start with an uppercase letter (if you own the package), or use the package's public API. Struct fields follow the same rule: lowercase fields are skipped by `encoding/json` and are not accessible externally.

## Common causes

- Function/type/field starts with a lowercase letter
- Accessing internal fields of a dependency
- Using a name from another package's internal/ directory
- Typo in capitalisation
- JSON struct fields lowercase so they never serialise

## Quick fix

1. Export it: `helper` → `Helper`
2. Use the exported API of the dependency
3. Place code in the same package if it must stay private

## Detailed fix by platform

### Go

1. Fields must be exported for JSON: `Name string `json:"name"``

## How to diagnose

1. **Name** — Uppercase first letter?
2. **Package** — Same or other?
3. **Field** — Used by json/reflect?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/go/unexported-name)
