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

fix: multiple issues with gofalcon example and client opts #38

Merged
merged 2 commits into from
Dec 30, 2024

Conversation

evanstoner
Copy link
Contributor

@evanstoner evanstoner commented Dec 30, 2024

This PR addresses multiple issues identified while developing a Falcon Function in Golang with gofalcon:

Also corrects minor unrelated Markdown formatting.

@evanstoner
Copy link
Contributor Author

👋 @jsteenb2 PTAL and let's chat on Slack if you have questions.

FYI @redhatrises @carlosmmatos

@@ -161,23 +161,19 @@ import (
"log/slog"

fdk "github.com/CrowdStrike/foundry-fn-go"
"github.com/CrowdStrike/gofalcon/falcon"
"github.com/CrowdStrike/gofalcon/falcon/client"
"github.com/crowdstrike/gofalcon/falcon"
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is very interesting, why does it need to be lowercase for gofalcon but not foundry-fn-go? Its the same github org yah?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The difference is from the go.mod - it's lowercase in gofalcon but capital CS in foundry-fn-go.

Copy link
Collaborator

Choose a reason for hiding this comment

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

super weird, curious why that's the case 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK all lower is the convention

Copy link
Collaborator

Choose a reason for hiding this comment

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

I know we've had users say they have to use the mixed case for go get, or it fails, which is super annoying. Ideally it'd be all lowercase. I'll have to figure out what's going on there.

@@ -19,15 +19,14 @@ var version = "development"
// AccessToken: token,
// Cloud: falcon.Cloud(opts.Cloud),
// Context: ctx,
// UserAgentOverride: out.UserAgent,
// UserAgentOverride: opts.UserAgent,
Copy link
Collaborator

Choose a reason for hiding this comment

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

oof good catch 👍

README.md Outdated
return fdk.Response{ /* snip */ }
}
// some other error - see gofalcon documentation
return fdk.Response{ Code: 500, Body: fdk.JSON(err) }
Copy link
Collaborator

@jsteenb2 jsteenb2 Dec 30, 2024

Choose a reason for hiding this comment

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

What's the motivation for returning a jsonified err? I think we're better off sticking with the fdk.ErrResp(fdk.APIError{Code: 500, Message: err.Error()}. This ties into fusion's execution log UI as well as align with the idiomatic error handling of errors in a funciton.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack hadn't seen this, will update.

Copy link
Collaborator

@jsteenb2 jsteenb2 Dec 30, 2024

Choose a reason for hiding this comment

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

unfortunately, looking at the sample apps for foundry, we don't have funcitons that utilize even a small percentage of our best practices. They need some TLC, so things like fdk.ErrResp, fdk.HandleFnOf, logging, etc are in plain view

Copy link
Collaborator

@jsteenb2 jsteenb2 left a comment

Choose a reason for hiding this comment

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

looks great, thanks for the contributions!

@jsteenb2 jsteenb2 merged commit 26f2a7a into CrowdStrike:main Dec 30, 2024
1 check passed
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