~ | | Following from the example PyDiffX, the following commits create the files
|
~ | | options.go , sections.go , and errors.go to be used in GoDiffX.
|
| ~ | Further updates from the previous week include work on text.go , the
|
| ~ | creation of testing files, and some small tweaks to bugs. |
- | | They are fairly straightforward files and do not do much on their own.
|
- | | However, they are just a few of the stepping stones needed to get to work on
|
- | | the main problem at hand. |
| |
|
~ | | options.go is just a few enums that can be used to konw what formats or types
|
~ | | are available in certain circumstances. While I am not 100% familiar with their
|
| ~ | The 'bugs' in question refer to typos in error messages found while testing
|
| ~ | and things like no Error() method being used for the errors. |
- | | use in the code, creating them as enums using iota seemed to be a simple
|
- | | approach to make the options available. |
| |
|
~ | | sections.go holds the section struct, a key piece of DiffX since it relies on
|
~ | | these different sections. One small roadblock when comparing this to PyDiffX is
|
~ | | that there are no classes in Go. However, we are still able to use Structs and
|
~ | | can replicate the functionality of classes is most cases. Another issue that was
|
| ~ | Progress has been made on Text.go , but this part of the code took me a while
|
| ~ | because it was a lot of learning and experimenting with bytes to better understand
|
| ~ | how they are treated by different objects. I have a much better understanding of
|
| ~ | the functionality now, but there are a couple more functions that need to be finished up. |
- | | encountered here is that go does not have access to sets. The workaround for
|
- | | this was to instead create them as maps where the value for each key is just
|
- | | true . |
| |
|
~ | | errors.go is a bunch of different errors that our program may need to throw.
|
~ | | Errors are handled differently in Go than in Python. Usually, if a function
|
| ~ | All of the work from the previous week is still here (i.e. work done on options.go ,
|
| ~ | sections.go , and errors.go . |
- | | encounters an error, it will just pass the error up in the function and it is up
|
- | | to the programmer to ensure the error is properly handled. For this reason, the
|
- | | errors themselves will never kill a program. However, they should all still have
|
- | | the same properties (such as line, column, and content) where appropriate. One
|
- | | note about this part is that there were some parts in Python that used unicode
|
- | | as a variable. I believe this is represented as a rune in Go, but more
|
- | | research has to be done. Because of this, the unicode parts are just strings for
|
- | | now. |
| |
|
| | In each of the files, the proper documentation was added via the inline
|
| | comments. These were also modelled closely after their respective python
|
| | counterparts, but there are some small differences due to Go's documentation
|
| | standards (i.e. requiring the comment to begin with the name of what it is
|
| | talking about). |