# Go: package app/cmd: no Go files in /app/cmd / build constraints exclude all Go files

**Code:** `no Go files in directory` · **Category:** Go · **Seen on:** Go

The directory you asked Go to build contains no buildable `.go` files.

## Meaning

Build the right package path (`go build ./cmd/server`), make sure files have the `.go` extension and are not excluded by build tags or `_GOOS`/`_GOARCH` suffixes, and that `_test.go` files aren't the only ones. In Docker verify the files were copied.

## Common causes

- Wrong directory (no .go files at that level)
- Only _test.go files present
- Build tags / filename suffix excluding all files for this OS/arch
- Files not copied into the Docker context
- Package in a subfolder

## Quick fix

1. Point to the actual main package: `go build ./cmd/app`
2. Check `//go:build` lines and `_linux.go` style suffixes
3. Verify `.dockerignore` and COPY steps

## Detailed fix by platform

### Go

1. `go list ./...` shows all buildable packages

## How to diagnose

1. **Path** — Contains .go files?
2. **Tags** — Exclude them?
3. **Docker** — Files present?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/go/no-go-files-in-directory)
