camel-k icon indicating copy to clipboard operation
camel-k copied to clipboard

Use `go:embed` instead of vfsgen for embedded resources handling

Open tadayosi opened this issue 2 years ago • 0 comments

It makes sense to use a feature from standard library instead of relying on a 3rd party library. Use of go:embed may also save us from periodical regens of resources.go and unexpected issues due to its inconsistency.

The challenges for using go:embed I identified so far are:

  • go:embed only allows embedding resources under its current dir. It's not possible to load resources in an arbitrary dir from pkg/resources. That should require you to put a resources.go under both /config and /resources dirs and then reference them from pkg/resources.
  • There is no easy way to ignore arbitrary files with go:embed. You can only ignore .* and _* files automatically. We'd need to find a way to keep the embedded resources clean and as minimum as possible.
    • https://github.com/golang/go/issues/42328
    • https://github.com/golang/go/issues/42325

tadayosi avatar Jun 22 '22 05:06 tadayosi