-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
loader: add support for fs.FS #5069
Conversation
@ear7h thanks for the contribution. It would be great if you could add some unit tests. |
@ashutosh-narkar updated with tests and fixed the lint |
8236fe2
to
8199ab7
Compare
Fixed DCO. Now CI is complaining about the JSON files I included. Running the failed command works fine locally (I copy/pasted in the json object in a local file). Any hints on this would be appreciated. |
It looks like the files you added failed this check. The |
Yea I get that, but the files are valid JSON |
That's interesting / weird. If I run the same tests manually, there are no complaints: curl --silent https://api.github.com/repos/open-policy-agent/opa/pulls/5069/files | opa eval -I -b build/policy --format values --fail-defined 'data.files.deny[message] Perhaps there's some issue with the GITHUB_TOKEN being passed as an env var, and picked up by the |
There's no correct way to provide the behavior of native `os` functions with an `fs.FS` since `fs.FS`s should reject rooted paths and only use unix path separators ("/"). Initially I created a `rawFS` that directly forwarded calls to the `os` package but it felt more wrong the more I looked at it. Relevant issues: * golang/go#47803 * golang/go#44279 closes open-policy-agent#5066 Signed-off-by: julio <julio.grillo98@gmail.com>
I'm gonna have to throw in the towel here 😫 Spent hours trying to understand what's going on here, but no matter what I (and many good ideas from @srenatus too!) have tried, the error here boils down to this: no matter what URL we provide to For posterity, some things tried:
So, for whatever reason, the combination of
Maybe one day, I'll get to know... but that day is not today. I'm sorry for the inconvenience here @ear7h .. we'll need to ignore the errors here for the scope of this PR. Not sure what to do for the future, but we can figure it out later. @srenatus if everything else checks out here, let's have this merged. |
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.
Nice first contribution 👏 Thanks!
Also for posterity — the problems described above turned out to be a real bug in OPA. Fixed in #5097 |
There's no correct way to provide the behavior of native
os
functionswith an
fs.FS
sincefs.FS
s should reject rooted paths and only useunix path separators ("/"). Initially I created a
rawFS
that directlyforwarded calls to the
os
package but it felt more wrong the more Ilooked at it.
Relevant issues:
closes #5066