Skip to content

Tag: go

Parsing YAML in GO

Go supports JSON via its standard libraries. However, it does not support YAML – which is interesting when you think about it. YAML is after all just JSON written in a specific way. It is useful to have a high-level understanding of how GO supports JSON before diving into YAML. The first thing you need to do is model your data as a struct: View the code on Gist. Notice how there is a string with some metadata for each field. This tells Go what each field is named in your JSON. After this, you can include the encoding/JSON library you get a…

Using Go to Recover JPEGs from a Forensic Image

CS50 is an introductory course offered by Harvard to students at the college and online via EdX and the Harvard Extension School. It teaches mostly through a series of problems sets which mostly focus on using C to solve them. One of the more interesting problem sets is Problem Set 4: Forensics. The Problem The original problem was solved in C as part of the course and here will be solved using Go. But before looking at any code it is important to give a little context (all code is available on GitHub for those that are interested). Key characteristics of the problem have been outlined below: What we…