Matched signals
- imported and not used
- declared and not used
- does not implement
- undefined:
- cannot use
- too many arguments in call to
- not enough arguments in call to
- cannot assign to
Go compilation error
What this failure means
The Go compiler rejected the package because of a semantic error — undefined identifier, type mismatch, unused import, or interface non-compliance. The binary cannot be produced until the errors are resolved.
Symptoms
Faultline looks for one or more of these log fragments:
imported and not used
declared and not used
does not implement
undefined:
cannot use
too many arguments in call to
not enough arguments in call to
cannot assign to
Diagnosis
The Go compiler emitted one or more hard errors and aborted the build. These
are always deterministic: the source must be corrected before go build ./...
can succeed.
Common error classes:
- undefined: — a symbol, function, or type is referenced but not declared in the current package or any imported package.
- cannot use X as Y — a value of one type is passed where a different type is required, and no implicit conversion exists.
- imported and not used — a package was imported but none of its exported names appear in the file.
- declared and not used — a local variable was declared but never read.
- does not implement — a concrete type is used where an interface is expected but is missing one or more methods.
Fix steps
-
Run
go build ./...locally to see the full diagnostic output:go build ./... 2>&1 | head -30 -
For
undefined: Foo: import the package that definesFooor move the declaration into scope. -
For
cannot use x (variable of type A) as type B: correct the type or add an explicit conversion where the semantics are safe. -
For
imported and not used: remove the unused import, or add a blank import_ "pkg"if the side-effect is intentional. -
For
declared and not used: use the variable or replace it with_. -
For
does not implement: add the missing method to the concrete type, or use the correct type that already satisfies the interface.
Validation
- Run
go build ./...locally and confirm zero errors. - Run
go vet ./...to catch additional semantic issues before CI. - Confirm the CI build step exits zero.
Why it matters
Go compilation errors are deterministic and hard — the build stops immediately with no output binary. All downstream test and deploy steps are blocked until the root error is fixed. The compiler message always names the exact file, line, and column: start there and work outward.
Prevention
- Run
go build ./...andgo vet ./...as a pre-push hook. - Enable editor integration (gopls / VS Code Go) so errors surface on save.
- Add a dedicated
go buildstep before the test step in CI so compile errors produce a clear signal rather than hiding inside a test failure.
Try it locally
go build ./...
go vet ./...
go build ./...
How Faultline detects it
Use faultline explain go-compile-error to see the full playbook.
faultline analyze build.log
faultline explain go-compile-error
Generated from playbooks/bundled/log/build/go-compile-error.yaml. Do not edit directly.