feat: add support for bun.lock#379
Conversation
|
It's generally fine to add new libraries if we think they can't be implemented easily on our side. Can you double check that this new import doesn't cause the SCALIBR binary size to get too much bigger? Regarding the Go version, do you mean that the lib needs Go 1.23 or beyond? We use Go 1.24 internally so requiring 1.23 or beyond should be fine for us. |
Yes that's my read of it - I think bumping the Go version could be a breaking change but either way probably best done in a dedicated PR. I'm happy to open that and we can continue any related discussion over there |
The |
|
@erikvarga I have gone ahead with switching out the library since |
Hm, if using tailscale means we have to wait until Go 1.24 is released so we'll stay compatible with the last 2 versions then maybe we're better off using tidwall/jsonc. |
|
@another-rex @erikvarga it doesn't look like this was landed properly - the import has been changed from Happy to do a PR changing that back, but not sure if that change was intentional as a result of your internals and that maybe something else should be being done? The more I think about it, the more I think this was a mistake related to internal vs external handling, so I've opened #420 |
|
Oops, I think I messed up the open source package name in our internal transformation rules. I'll have to fix that internally tomorrow (unless OSV folks get around to doing it first) |
As part of improving ergonomics, Bun has introduced a new text-based lockfile which this adds support for extracting.
While the blog post claims that it's "JSON with comments" (aka
JSONC), it's actually "JSON with comments and trailing commas" (akaJWCCorHuJSON) - since the Go standard library only supports parsing standard JSON, I've had to bring in a third-party library to handle parsing, which is designed to leverage the existing standard library by instead handling "standardizing" the input into valid boring JSON.Aside from the general question of if this library is acceptable to use here, it also seems to require Go 1.23 resulting in the addition of a(I've since switched to using a library that requires Go 1.16)toolchainline ingo.modwhich I've never managed to quite figure out what the right thing to do with - overall, I'd like someone from Google to confirm what library they'd prefer we use here.I have also specified the testdata fixtures as JSON5 as that's the most appropriate format supported by both VSCode and IntelliJ/GoLand, though that technically supports more features like single quotes (which it actually seems like
bundoes not mind if you use in your lockfile, though it'll always use double quotes itself) - personally I think that's fine, but don't mind renaming the files to be.hujsonif folks would prefer.Resolves google/osv-scanner#1405