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

feat(go): add temp file leak section to troubleshooting #8376

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/platforms/go/common/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ Since the Go SDK tries to read the source files from your local disk, it's possi
This is common in Go because you can compile the binary, and then have no more need for the source code. Without access to the source code, however, we can’t map anything back, and we don’t support uploading Go source code with a release to stitch this data on.

You can see [in the Serverless section](/platforms/go/serverless/#source-context) how to bundle the source code with the binary, which applies to other forms of deployment as well.

## Avoiding Temporary File Leaks In File Upload Handlers

Go SDK middleware has to modify the request context in order to function correctly. This results in a shallow copy of the request being passed to upstream handlers. Temporary files created from calling `ParseMultipartForm` on this request will not automatically be cleaned up. It's important ensure these files are cleaned up by calling `request.Multipart.RemoveAll()` after.
shanamatthews marked this conversation as resolved.
Show resolved Hide resolved

See the [multipart documentation](https://pkg.go.dev/mime/multipart#Form.RemoveAll) for more information.