Skip to content

Commit

Permalink
fix: some fixes :D
Browse files Browse the repository at this point in the history
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
  • Loading branch information
worstell committed Jul 12, 2024
1 parent df93625 commit dc806a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
10 changes: 7 additions & 3 deletions go-runtime/compile/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions go-runtime/schema/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -42,7 +41,7 @@ var Extractors = [][]*analysis.Analyzer{
inspect.Analyzer,
},
{
call.Extractor,
// call.Extractor,
metadata.Extractor,
},
{
Expand Down
6 changes: 0 additions & 6 deletions go-runtime/schema/verb/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit dc806a7

Please sign in to comment.