mirror of
https://github.com/apple/pkl.git
synced 2026-01-13 15:13:38 +01:00
Custom ResourceReader implementation in Golang fails to decode read data #206
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @barahona42 on GitHub (Sep 22, 2024).
context
Hi all, first time submitting a bug report ever. Here's the info:
read("ssm:/foo/SomeParameterPath")is assigned to a pkl resource.go1.23.0outputs
pkl --version: Pkl 0.26.3 (macOS 14.3.1, native).pklfile:Readmethod returns a byte array as shown below:.Load()method.bdo make a difference:[]byte(*v),[]byte("foo"), the following error returns:Any pointers/insight on this would be appreciated. Thank you.
@HT154 commented on GitHub (Sep 22, 2024):
The issue with returning an empty/nil byte slice is definitely a bug! The read contents are assumed to be non-null even though an empty byte slice on the go side is encoded as nil. A fix similar to https://github.com/apple/pkl/pull/480 is needed for this, which should be pretty straightforward. I'll probably have a PR up for this later today or tomorrow.
@HT154 commented on GitHub (Sep 22, 2024):
The other issue is not as clear. Can you share some of the exact code that produced that error?
You definitely don't need to do the msgpack encoding yourself, just return the string produced by your resource directly, eg.
return []byte("foo"), nilPS: great bug report! ❤️
@barahona42 commented on GitHub (Sep 23, 2024):
Thanks for the response. Here's the implementation of the resource and the code that gets the ssm parameter value.