-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Proposal for incremental path refactor #995
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/vercel/turbo-site/FbQMxozP7bpuengQW9GebAH3TEgv |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
// and is used to enfore correct path manipulation | ||
type AbsolutePath string | ||
|
||
func CheckedToAbsolutePath(s string) (AbsolutePath, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we call this SafeAbsolutePath
?
This PR is a proposal for how we can start to get a handle on the various kinds of paths that
turbo
uses.My goal is the following:
--cwd
, which is likely currently brokenpath/filepath
and a subset ofos.*
functions anywhere in the codebase outsidepath.go
. It may even be possible to automate this in CI. Furthermore, entry points and exit points from our custom types (currently justAbsolutePath
) are clearly marked, along with the intention of eventually migrating them, if appropriate (e.g.ToStringDuringMigration
,UnsafeToAbsolutePath
).fs.AbsolutePath
, even if they need to use one of the migration functions to facilitate that. Hopefully this will force both the submitter and reviewer to focus on ensuring that the new code will work properly with--cwd
.I've done a few pieces of the migration to show what it would look like in the code base in a partially migrated state.
path.go
contains theAbsolutePath
type, which ideally would be the sole way to interact with the filesystem. Please let me know what you think about the api and the migration overall.