anagrambler.go: 'anagrambler' package, containing data structures and main program logic
anagrambler_test.go: testing code for 'anagrambler' package
main.go: command line tool that imports 'anagrambler', prepares user input, calls the main machinery.
This works, but there are two small issues:
It seems a more common pattern for library code to live in /pkg or /internal, apparently. This does make the organization clearer; it's library code, so that's where it goes.
By putting the 'anagrambler' package in the top directory or /pkg, we're essentially implicitly making a public guarantee of backwards compatibility, as per the Go project recommendations. We could consider using an /internal directory, to communicate that the code isn't yet designed for exporting. (Or is it ready for exporting? I'm not sure. Maybe it's fine.)
We could also move the anagrambler.go code into cmd/anagrambler/, I suppose; it's mainly application code, and does things like file input. You could argue it's not exactly designed as a library.
We can also just leave everything as it is and forget about it. It's not hurting anything. I want it to be """right""", but I am also definitely overthinking it.
Also the location of go-dict.txt sticks in my craw too but that's an issue with less of a canonical answer.
I don't think I even remembered writing this when I made #20 in September, but I did exactly what I wrote. At least I'm internally consistent? Anyhow yeah, closed: done in #20.
Currently, the project is structured like this:
anagrambler.go
: 'anagrambler' package, containing data structures and main program logicanagrambler_test.go
: testing code for 'anagrambler' packagemain.go
: command line tool that imports 'anagrambler', prepares user input, calls the main machinery.This works, but there are two small issues:
/pkg
or/internal
, apparently. This does make the organization clearer; it's library code, so that's where it goes./pkg
, we're essentially implicitly making a public guarantee of backwards compatibility, as per the Go project recommendations. We could consider using an/internal
directory, to communicate that the code isn't yet designed for exporting. (Or is it ready for exporting? I'm not sure. Maybe it's fine.)We could also move the
anagrambler.go
code intocmd/anagrambler/
, I suppose; it's mainly application code, and does things like file input. You could argue it's not exactly designed as a library.We can also just leave everything as it is and forget about it. It's not hurting anything. I want it to be """right""", but I am also definitely overthinking it.
Also the location of
go-dict.txt
sticks in my craw too but that's an issue with less of a canonical answer.