Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding "if" function to tick #745

Merged
merged 1 commit into from
Aug 2, 2016
Merged

Conversation

yosiat
Copy link
Contributor

@yosiat yosiat commented Jul 23, 2016

Required for all non-trivial PRs
  • Rebased/mergable
  • Tests pass
  • CHANGELOG.md updated
  • Sign CLA (if not already signed)

Fixes #741


func (*ifFunc) Call(args ...interface{}) (interface{}, error) {
if len(args) != 3 {
return nil, errors.New("if expects exactly three argument")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can you change argument to arguments?

@nathanielc
Copy link
Contributor

@yosiat Looks great! A few small questions but overall this looks ready to go.

@yosiat yosiat force-pushed the if-funciton branch 2 times, most recently from 49f14d4 to f1f90d6 Compare July 29, 2016 17:19
@yosiat
Copy link
Contributor Author

yosiat commented Jul 29, 2016

@nathanielc fixed everything 👍

}

if reflect.TypeOf(args[1]) != reflect.TypeOf(args[2]) {
return nil, fmt.Errorf("Multiple return types isn't supported - second argument is %T and third argument is %T", args[1], args[2])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

I think this would read better if it read: Different return types are not supported - ...

// multiple types
{
args: []interface{}{false, 1, "1"},
err: errors.New("Multiple return types isn't supported - second argument is int and third argument is string"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are failing on this error message.

@nathanielc nathanielc merged commit bedf3a8 into influxdata:master Aug 2, 2016
@yosiat yosiat deleted the if-funciton branch August 3, 2016 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants