is there an idiomatic way to do this in go?