Go "t.Method undefined (type T has no field or method Method)" in CI
The compiler resolved the receiver type and found no field or method by that name. The name may be misspelled, unexported from another package, or defined on a different type or a pointer receiver.
What this error means
Compilation fails with "t.Method undefined (type T has no field or method Method)" at a method call or field access.
go build
./svc.go:24:11: c.Fetch undefined (type *Client has no field or method Fetch)Common causes
A typo or a renamed method
The method name does not match what the type declares, often after a rename that missed this caller.
A pointer vs value receiver mismatch, or an unexported name
The method exists on *T but you hold a T value (or vice versa), or the name is lowercase and not exported from its package.
How to fix it
Call the correct, exported method
- Check the type definition for the exact method name and receiver.
- Fix the spelling, or take the address (
&v) if the method has a pointer receiver. - For cross-package use, confirm the method is exported (capitalized).
svc.go
// method has a pointer receiver
c := &Client{}
c.Fetch(ctx)Update callers after a rename
When you rename a method, update every caller in the same change so none references the old name.
How to prevent it
- Build the whole module in CI so missing methods surface.
- Use editor "find references" when renaming methods.
- Keep pointer and value receivers consistent across a type.
Related guides
Go "cannot use x (variable of type T) as U value in argument" in CIFix Go "cannot use x (variable of type T) as U value in argument to f" in CI - a value is passed to a functio…
Go "not enough arguments in call to f" in CIFix Go "not enough arguments in call to f" in CI - a function is called with fewer arguments than its signatu…
Go "X redeclared in this block / other declaration of X" in CIFix Go "X redeclared in this block: other declaration of X" in CI - two declarations with the same name exist…