-
Notifications
You must be signed in to change notification settings - Fork 728
Description
This is a WIP which I want to do about this issue.
Currently, some test code prepares test-data as a raw byte variable. These code are not supported by LSP and it's a little hard to read test-data.
After Go1.16, we can use embed function to embed files in Go code. This results in that we can separate test-data and test-code, then test-data is supported by native LSP.
But I'm concerning about the formatted code.
Here is the example.
https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/util/config/cluster_test.go#L50
Regarding above code, we can automatically migrate to minimum control plane version, but if these codes like this converts to embedded way, we should migrate manually from now on, then I think it's not good in term of maintaining.
So I propose the 2 rule.
- Basically, it's prefer to use go:embed if you want to prepare the test-data
- But, if the test data you prepare plan to be formatted, it's prefer to define as a raw byte string on Go file.
What do you think ?