

They obviously have their challenges, however in this post I intent to present a very basic example of saving models (struct) into binary file and later reading it. My assumption is a misunderstanding of pointer/values at some point, but the compiler prevented a usage of &f. golang Reading and writing binary files can often be a fast and very efficient alternatives to csv. On Linux or Mac: cd On Windows: cd HOMEPATH Create a hello directory for your first Go source code. Open a command prompt and cd to your home directory. Write some code Get started with Hello, World.

All other outputs indicate expected behavior, so what is my mistake? I'm somewhat restricted to using the File interface, otherwise I'd have gone with ioutil.WriteFile(). Install Go Just use the Download and install steps. Which leads me to believe I'm using f.Write() not correctly, although I followed the package documentation. The output of above code looks like this: However, the file is always empty when I run the code in my environment (AWS Lambda), as well as using it in the Golang Playground. Currently I have following code (with test debug outputs), which does not provide expected result: json, _ := json.Marshal(struct)į,_ := os.Create(fmt.Sprintf("/tmp/%s.json", "asd")) I'm rather new to Golang and not sure yet, how to use certain language constructs.
