Fix duplicate module names

These module names appear more than once:

$ rg -I 'module ' | sort | uniq -c | sort -nr | grep -E -v '\s+1' 
      2 module prime
      2 module matrix
      2 module linkedlist
      2 module lasagna

I am working with exercises locally, using go.work file:

Duplicate module names are not allowed in the go workspaces.
So let’s avoid duplication by renaming such modules.

Reference on what should be in the module name:

Worth reading and relevant here: Suggesting Exercise Improvements | Exercism's Docs

@IsaacG I did read it.
Can we re-open and merge Fix duplicate module names by alexbozhenko · Pull Request #2743 · exercism/go · GitHub ?
Seems like a tiny change, and the right thing to do.

Not my track, not my call. I’m pretty sure it would break all the existing solutions, though (over 11,000)! That seems like a pretty big change to me.

Me and @junedev discussed this a while ago and we also agree that there shouldn’t be duplicated module names.

The main motivation for this is precisely the creation of a go.work file, not only for students to make it easier to manage multiple go modules, but also for us maintainers, as it would be good to have a go.work file at the root of exercism/go so editors can easily make sense of all the modules we have.

An easy rule of thumb for this would be to have the module names match the folder name (eventually allowing replacing - with _ and such), as there shouldn’t be any duplicated names. It would also be good to have CI check for this automatically, which we can do easily.

But like @IsaacG said, this is something we should be careful in doing, as it is a big change. Maybe a good approach would be to do it little by little, one exercise at a time. @iHiD what do you think would be best to do here? Is this something we can do, or should we leave things as they are now?

1 Like