Skip to content
Latchkey

Go "malformed module path: missing dot" - Fix in CI

Go requires the first element of a module path to look like a host name, which means it must contain a dot. A bare name like "myapp" is rejected because it cannot be a real import host.

What this error means

A module command fails with malformed module path "myapp": missing dot in first path element. The module directive uses a bare name instead of a domain-style path.

go
go: malformed module path "myapp": missing dot in first path element

Common causes

Bare module name in go.mod

The module directive names something without a dotted host, which Go cannot treat as an importable path.

go mod init with no domain

go mod init was run with a single word, producing an invalid module path.

How to fix it

Use a domain-style module path

  1. Set the module directive to a host-prefixed path.
go.mod
module github.com/acme/myapp

go 1.22

Re-init with a full path

  1. Re-run go mod init with a domain-prefixed module path.
shell
go mod init github.com/acme/myapp

How to prevent it

  • Always use a host-prefixed module path even for private repos.
  • Run go mod init with the full path from the start.
  • Match the module path to the repo URL so imports resolve.

Frequently asked questions

What causes ""malformed module path: missing dot""?
The module directive names something without a dotted host, which Go cannot treat as an importable path.
How do I fix "malformed module path: missing dot"?
Use a domain-style module path

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card