# "Build your own shell" - Stage #MG5 (in C): can't run tests. Failed to run go build

**URL:** <https://forum.codecrafters.io/t/build-your-own-shell-stage-mg5-in-c-cant-run-tests-failed-to-run-go-build/650>\
**Category:** Challenges\
**Tags:** challenge:shell\
**Created:** [June 7, 2024, 10:40am UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-mg5-in-c-cant-run-tests-failed-to-run-go-build/650 "2024-06-07T10:40:22Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![AZarbade](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/azarbade/32/590_2.png) [@AZarbade](https://forum.codecrafters.io/u/AZarbade)\
**Post date:** [June 7, 2024, 10:40am UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-mg5-in-c-cant-run-tests-failed-to-run-go-build/650/1 "2024-06-07T10:40:22Z")

</div>

I’m stuck on Stage #MG5.

When ran locally:

```auto
PATH="/usr/bin:/usr/local/bin" ./your_shell.sh

```

Output:

```auto
Tokens:
/usr/bin
/usr/local/bin
$ type ls
ls is /usr/bin/ls
$

```

Here are my logs:

```auto
Initiating test run...

⚡ This is a turbo test run. https://codecrafters.io/turbo

Running tests. Logs should appear shortly...

Debug = true

[tester::#MG5] Running tests for Stage #MG5 (The type builtin: executable files)
[tester::#MG5] failed to run go build: exec: "go": executable file not found in $PATH
[tester::#MG5] Test failed

View our article on debugging test failures: https://codecrafters.io/debug

```

---

<div class="post-metadata">

**Author:** ![Xenon03](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/xenon03/32/594_2.png) [@Xenon03](https://forum.codecrafters.io/u/Xenon03)\
**Post date:** [June 7, 2024, 12:51pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-mg5-in-c-cant-run-tests-failed-to-run-go-build/650/2 "2024-06-07T12:51:58Z")

</div>

same here…  
locally it works fine, but when I try with “codecrafters test” or with git it gives me the same error.

 ![Screenshot from 2024-06-07 14-51-42](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/1X/0916635befb1e9dcafe37c6296039ad007c35087.png)

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [June 7, 2024, 1:40pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-mg5-in-c-cant-run-tests-failed-to-run-go-build/650/3 "2024-06-07T13:40:46Z")

</div>

Hey everyone,

Thanks for reporting this! Can confirm that this is an issue with how our test runner environments are built, we’re looking into this…

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [June 7, 2024, 4:58pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-mg5-in-c-cant-run-tests-failed-to-run-go-build/650/4 "2024-06-07T16:58:41Z")

</div>

This should be fixed now!

> <https://github.com/codecrafters-io/build-your-own-shell/pull/10>
>
> Go is required for creating the custom executable used in shell tests. Missing t…he go install would prohibit us from running shell tests.

Will keep this open until someone confirms the fix worked for them 🙂

---

<div class="post-metadata">

**Author:** ![Xenon03](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/xenon03/32/594_2.png) [@Xenon03](https://forum.codecrafters.io/u/Xenon03)\
**Post date:** [June 7, 2024, 5:18pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-mg5-in-c-cant-run-tests-failed-to-run-go-build/650/5 "2024-06-07T17:18:52Z")

</div>

works! thank you so much 🙂

---

<div class="post-metadata">

**Author:** ![AZarbade](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/azarbade/32/590_2.png) [@AZarbade](https://forum.codecrafters.io/u/AZarbade)\
**Post date:** [June 7, 2024, 5:23pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-mg5-in-c-cant-run-tests-failed-to-run-go-build/650/6 "2024-06-07T17:23:27Z")

</div>

The tests appear to be functioning correctly. Although there is a warning related to loading internal components.

It could be a issue within my code, but the last test is failing. Is the test is looking for the “my\_exe” executable in my local/project directory?

```auto
[tester::#MG5] Running tests for Stage #MG5 (The type builtin: executable files)
# command-line-arguments
loadinternal: cannot find runtime/cgo
[tester::#MG5] Running ./your_shell.sh
[your-program] $
[tester::#MG5] > type cat
[your-program] cat is /bin/cat
[tester::#MG5] ✓ Received expected response
[your-program] $
[tester::#MG5] > type cp
[your-program] cp is /bin/cp
[tester::#MG5] ✓ Received expected response
[your-program] $
[tester::#MG5] > type mkdir
[your-program] mkdir is /bin/mkdir
[tester::#MG5] ✓ Received expected response
[your-program] $
[tester::#MG5] > type my_exe
[your-program] my_exe: command not found
[your-program] $
[tester::#MG5] Expected output to match "my_exe is /app/my_exe", got "my_exe: command not found\r\n$ "
[tester::#MG5] condition not met
[tester::#MG5] Test failed

```

---

<div class="post-metadata">

**Author:** ![Xenon03](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/xenon03/32/594_2.png) [@Xenon03](https://forum.codecrafters.io/u/Xenon03)\
**Post date:** [June 7, 2024, 5:28pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-mg5-in-c-cant-run-tests-failed-to-run-go-build/650/7 "2024-06-07T17:28:10Z")

</div>

Getting the “runtime/cgo” loading error too, but it passed all the tests so guess there’s something wrong in your code (I’m using linux so I don’t know, maybe mine won’t work too in Windows!).

---

<div class="post-metadata">

**Author:** ![AZarbade](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/azarbade/32/590_2.png) [@AZarbade](https://forum.codecrafters.io/u/AZarbade)\
**Post date:** [June 7, 2024, 5:30pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-mg5-in-c-cant-run-tests-failed-to-run-go-build/650/8 "2024-06-07T17:30:05Z")

</div>

I am on Linux (Pop os). I will check my code, maybe I missed something.

---

<div class="post-metadata">

**Author:** ![Xenon03](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/xenon03/32/594_2.png) [@Xenon03](https://forum.codecrafters.io/u/Xenon03)\
**Post date:** [June 7, 2024, 5:31pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-mg5-in-c-cant-run-tests-failed-to-run-go-build/650/9 "2024-06-07T17:31:44Z")

</div>

oh alr, got confused reading exe hehe.  
if u want u can take hint from mine, just uploaded.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [June 12, 2024, 5:32pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-mg5-in-c-cant-run-tests-failed-to-run-go-build/650/10 "2024-06-12T17:32:28Z")

</div>

Closed on June 12, 2024, 5:32pm UTC

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