I am using this as a tool to learn golang.
The app is a CLI that models a robot moving about on a 5x5 table.
PLACE 1,1,NORTH
MOVE
LEFT
RIGHT
REPORT
- Get something that works, without worrying too much about go idioms.
- CURRENT - Update to be idiomatic go code, unless there is a good reason.
- Polish and finish.
For example, my parsing functions return nil
to indiciate a failure to parse. Should this be the err
pattern instead which seems standard in go?
I do a lot of pass by value, which duplicates the value to pass it into the function and will not mutate the original value. This seems like a good thing, but will have performance implications.
Is idiomatic go using pass by ref and attempting safe mutation? Should I change to this style?
The code structure is based on my Haskell toy robot. However, I think perhaps a feature based package breakdown might be nice, ie parsing + processing.
I am using some non-standard? techniques to avoid modelling some types as strings. Ie. the commands and direction. Not sure how unidiomatic these are.