Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Remove *ByName function variants
Browse files Browse the repository at this point in the history
  • Loading branch information
Porges committed Nov 22, 2020
1 parent cfa92bb commit 1af11ba
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion hack/generator/pkg/astbuilder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func FormatError(formatString string, args ...ast.Expr) ast.Expr {
callArgs,
StringLiteral(formatString))
callArgs = append(callArgs, args...)
return CallQualifiedFuncByName("fmt", "Errorf", callArgs...)
return CallQualifiedFunc("fmt", "Errorf", callArgs...)
}

// AddrOf returns a statement that gets the address of the provided expression.
Expand Down
7 changes: 0 additions & 7 deletions hack/generator/pkg/astbuilder/calls.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ func CallQualifiedFunc(qualifier string, funcName string, arguments ...ast.Expr)
}
}

// CallQualifiedFuncByName() creates an expression to call a qualified function of the specified
// name with the given arguments, generating code like:
// <qualifier>.<funcName>(arguments...)
func CallQualifiedFuncByName(qualifier string, funcName string, arguments ...ast.Expr) ast.Expr {
return CallQualifiedFunc(qualifier, funcName, arguments...)
}

// InvokeFunc() creates a statement to invoke a function with specified arguments, generating code
// like
// <funcName>(arguments...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (builder *convertFromArmBuilder) namePropertyHandler(
astbuilder.CallFunc(
// "calling" enum name is equivalent to casting
ast.NewIdent(typeName.Name()),
astbuilder.CallQualifiedFuncByName(
astbuilder.CallQualifiedFunc(
astmodel.GenRuntimePackageName,
"ExtractKubernetesResourceNameFromArmName",
&ast.SelectorExpr{
Expand Down Expand Up @@ -190,7 +190,7 @@ func (builder *convertFromArmBuilder) namePropertyHandler(
Sel: ast.NewIdent(string(toProp.PropertyName())),
},
token.ASSIGN,
astbuilder.CallQualifiedFuncByName(
astbuilder.CallQualifiedFunc(
astmodel.GenRuntimePackageName,
"ExtractKubernetesResourceNameFromArmName",
&ast.SelectorExpr{
Expand Down

0 comments on commit 1af11ba

Please sign in to comment.