diff --git a/codegen/templates/templates.go b/codegen/templates/templates.go index 332498f878f..976527578da 100644 --- a/codegen/templates/templates.go +++ b/codegen/templates/templates.go @@ -172,7 +172,7 @@ func parseTemplates(cfg Options, t *template.Template) (*template.Template, erro fileSystem = cfg.TemplateFS } else { // load path relative to calling source file - _, callerFile, _, _ := runtime.Caller(1) + _, callerFile, _, _ := runtime.Caller(2) rootDir := filepath.Dir(callerFile) fileSystem = os.DirFS(rootDir) }