From dc806a7f47c85a03a937740a26e5efc2c95de26c Mon Sep 17 00:00:00 2001 From: Elizabeth Worstell Date: Fri, 12 Jul 2024 10:30:20 -0700 Subject: [PATCH] fix: some fixes :D removing an error on the verb- added this in because we had it in the legacy extractor in a PR that was missed, but not sure about the rationale so would like to discuss before updating downstream customers to comply fixes a code gen issue for types.ftl.go disabling call extractor; will re-enable when fully implemented in follow-up --- go-runtime/compile/build.go | 10 +++++++--- go-runtime/schema/extract.go | 3 +-- go-runtime/schema/verb/analyzer.go | 6 ------ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/go-runtime/compile/build.go b/go-runtime/compile/build.go index 37ba8ad9d9..dff916d129 100644 --- a/go-runtime/compile/build.go +++ b/go-runtime/compile/build.go @@ -793,10 +793,14 @@ func getGoExternalType(fqName string) (_import string, _type string, err error) if err != nil { return "", "", err } - pkg := im[strings.LastIndex(im, "/")+1:] - if i := strings.LastIndex(im, " "); i != -1 { + unquoted, err := strconv.Unquote(im) + if err != nil { + return "", "", fmt.Errorf("failed to unquote import %q: %w", im, err) + } + pkg := unquoted[strings.LastIndex(unquoted, "/")+1:] + if i := strings.LastIndex(unquoted, " "); i != -1 { // import has an alias and this will be the package - pkg = im[:i] + pkg = unquoted[:i] } typeName := fqName[strings.LastIndex(fqName, ".")+1:] return im, fmt.Sprintf("%s.%s", pkg, typeName), nil diff --git a/go-runtime/schema/extract.go b/go-runtime/schema/extract.go index 6332b68846..eede64cf4a 100644 --- a/go-runtime/schema/extract.go +++ b/go-runtime/schema/extract.go @@ -4,7 +4,6 @@ import ( "fmt" "go/types" - "github.com/TBD54566975/ftl/go-runtime/schema/call" "github.com/TBD54566975/ftl/go-runtime/schema/configsecret" "github.com/TBD54566975/ftl/go-runtime/schema/data" "github.com/TBD54566975/ftl/go-runtime/schema/enum" @@ -42,7 +41,7 @@ var Extractors = [][]*analysis.Analyzer{ inspect.Analyzer, }, { - call.Extractor, + // call.Extractor, metadata.Extractor, }, { diff --git a/go-runtime/schema/verb/analyzer.go b/go-runtime/schema/verb/analyzer.go index 7bcad54d71..07906f3ddb 100644 --- a/go-runtime/schema/verb/analyzer.go +++ b/go-runtime/schema/verb/analyzer.go @@ -63,12 +63,6 @@ func Extract(pass *analysis.Pass, root *ast.FuncDecl, obj types.Object) optional } func checkSignature(pass *analysis.Pass, node *ast.FuncDecl, sig *types.Signature) (req, resp optional.Option[*types.Var]) { - if expVerbName := strcase.ToUpperCamel(node.Name.Name); node.Name.Name != expVerbName { - common.Errorf(pass, node, "unexpected verb name %q, did you mean to use %q instead?", node.Name.Name, - expVerbName) - return optional.None[*types.Var](), optional.None[*types.Var]() - } - params := sig.Params() results := sig.Results() if params.Len() > 2 {