This could either be a file path question, or a question on how to best implement an interface.
Given the following very simple yaml:
name: MyYamlName
data: some/relative/path.txt
I would like to unmarshal it to the following struct:
type VerySimple struct {
name string
data io.Reader
}
I'm already using the yaml.v2 library, and know that for simple types, I can implement the Unmarshaller interface. However, in my program, I can't assume an absolute root from which to base the relative path in the data
field.
Is there a way to implement the Unmarshaller
interface to pass a working directory, or maybe a different way to handle relative paths in Go?