Final step on Shell (golang) is not passing - stuck and suspect test error

I’m stuck on Stage #gp4 .

I’ve tried … (mention what you’ve tried so far).

I keep getting the same error output and I suspect there is a problem with the test. I’ve been unable to change the error message no matter how I change or comment out the code. I’ve tried printing debug messages, but those don’t print either. I am wondering if there is a problem with the test.

If I run the code locally, it works fine, but running the tests with codecrafters test always fails on this particular test.

Here are my logs:

[tester::#GP4] Running tests for Stage #GP4 (Navigation - The cd builtin: Home directory)
[tester::#GP4] Running ./
[tester::#GP4] Expected prompt ("$ ") to be printed, got ""
[tester::#GP4] Test failed

And here’s a snippet of my code:

1 Like

I think we both hit the same issue at the same time. Mods feel free to merge/remove mine, I’m having the exact same error as this.

1 Like

+1 to this looks like an error in the tests

1 Like

I’m stuck in the same error too.

1 Like

Thanks for reporting this, everyone!

We’ve identified this to be a caching issue where some languages rely on $HOME to cache build artifacts, so when this stage executes a script with a different HOME it starts compiling / downloading dependencies again.

We’re still thinking about how to rectify this… Fixing each language’s reliance on $HOME feels very error-prone and hard for us to get right. Our current most promising idea is to change the tests for this stage to work with a fixed HOME value and test things like cd ~/random_dir.

I am also facing this issue.

1 Like

Okay! We’ve fixed this here:

Will keep this open until someone confirms the fix works for them.

(Sorry for the delay here, wasn’t fully sure about what approach we want to take!)

1 Like

Okay looks like some Go users have passed this stage already - going to mark as closed! Please leave a reply here if you’re still running into issues.

Note that earlier stages might fail with the new tester, more on that here: Build your own Shell tests are now more strict with checking output

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.