I want to read in the content of files while compiling time to simplify the shipping of template files with a binary.
using the comptime keyword to run arbitrary code at compilation-time.
Ref: https://ziglang.org/documentation/master/#Introducing-the-Compile-Time-Concept
func main() {
content := comptime os.Open("./code.json")
....
}
We aren't going to permit arbitrary code to run at compile time.
The specific topic of embedding files in a compiled binary is #35950.
Also there is go generate which should be used instead for code generation.
For the reasons mentioned above, this is a likely decline. Leaving open for four weeks for final comments.
No further comments.
Most helpful comment
We aren't going to permit arbitrary code to run at compile time.
The specific topic of embedding files in a compiled binary is #35950.