codecrafters-io / build-your-own-grep

Definition for the grep challenge.
https://app.codecrafters.io/courses/grep/overview
MIT License
11 stars 9 forks source link

Regarding refactoring of solutions in multiple files as opposed to just single file #101

Open Bigguysahaj opened 1 week ago

Bigguysahaj commented 1 week ago

At one point of the solution, it just seems ideal to refactor and distribute the codes into various files. But testing of these files are not supported.

In my case where I'm using go , I have to keep all my code within main.go. The reason to my understanding is the following code in your_program.sh.

 # this is the current included code
 go build -o /tmp/codecrafters-build-grep-go cmd/mygrep/main.go
 # something like this would be more helpful
 go build -o /tmp/codecrafters-build-grep-go ./cmd/mygrep/...

I would like to know if this behavior of keeping all the code in just one file is by design, and if so what is the main idea behind it?

rohitpaulk commented 1 week ago

@Bigguysahaj not by design! Seems like a bug in fact, we do suggest splitting out files in https://docs.codecrafters.io/challenges/language-support/go.

rohitpaulk commented 1 week ago

We'll take a look at this! In the meantime, you should be able to change the files in .codecrafters/{compile/run}.sh to get the tester to include your files.

rohitpaulk commented 1 week ago

(will probably get to this next week or the week after)