# "Build your own shell" - Stage #IP1 (golang): Expected outpout to match

**URL:** <https://forum.codecrafters.io/t/build-your-own-shell-stage-ip1-golang-expected-outpout-to-match/669>\
**Category:** Challenges\
**Tags:** challenge:shell\
**Created:** [June 8, 2024, 1:12pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-ip1-golang-expected-outpout-to-match/669 "2024-06-08T13:12:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![StarPal13](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/starpal13/32/296_2.png) [@StarPal13](https://forum.codecrafters.io/u/StarPal13)\
**Post date:** [June 8, 2024, 1:12pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-ip1-golang-expected-outpout-to-match/669/1 "2024-06-08T13:12:37Z")

</div>

I’m stuck on Stage #IP1.

I’ve managed to run the external command but the outpout does not match the expected outpout. I’ve looked at some code examples and even though I have the same implementation as them I can’t seem to pass the test.

Here are my logs:

```auto
[tester::#IP1] Running tests for Stage #IP1 (Run a program)
[tester::#IP1] Running ./your_shell.sh
[your-program] $ 
[tester::#IP1] > my_exe James
[your-program] Hello james! The secret code is 401453.
[tester::#IP1] Expected output to match "Hello James! The secret code is 401453.\n", got "Hello james! The secret code is 401453.\r\n"
[tester::#IP1] condition not met
[tester::#IP1] Test failed

```

And here’s a snippet of my code:

```golang
func startRepl() error {
	commands := getCommands()

	reader := bufio.NewScanner(os.Stdin)
	printPrompt()

	for reader.Scan() {
		text := cleanInput(reader.Text())
		spltText := strings.Split(text, " ")
		if command, exists := commands[spltText[0]]; exists {
			err := command.Callback(spltText[1:]...)
			if err != nil {
				return fmt.Errorf("error running command err: %w", err)
			}
		} else {
			if file, err := handleEnviromentVariablePaths(spltText[0]); err == nil {
				cmd := exec.Command(file, spltText[1:]...)
				cmd.Stderr = os.Stderr
				cmd.Stdout = os.Stdout

				if err := cmd.Run(); err != nil {
					return fmt.Errorf("error running external command err: %w", err)
				}
			} else {
				fmt.Printf("%s: command not found\n", spltText[0])
			}
		}
	}

	return nil
}

```

---

<div class="post-metadata">

**Author:** ![fre-ros](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/fre-ros/32/528_2.png) [@fre-ros](https://forum.codecrafters.io/u/fre-ros)\
**Post date:** [June 8, 2024, 7:53pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-ip1-golang-expected-outpout-to-match/669/2 "2024-06-08T19:53:46Z")

</div>

You are passing `james` instead of `James` so somewhere in your code you convert the intput to lowercase, maybe in `cleanInput`?

---

<div class="post-metadata">

**Author:** ![StarPal13](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/starpal13/32/296_2.png) [@StarPal13](https://forum.codecrafters.io/u/StarPal13)\
**Post date:** [June 8, 2024, 9:46pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-ip1-golang-expected-outpout-to-match/669/3 "2024-06-08T21:46:22Z")

</div>

You are completely right about that. I didn’t even see that, I thought that the error was thrown because of the \r\n instead of \n.

---

<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 13, 2024, 9:46pm UTC](https://forum.codecrafters.io/t/build-your-own-shell-stage-ip1-golang-expected-outpout-to-match/669/4 "2024-06-13T21:46:37Z")

</div>

Closed on June 13, 2024, 9:46pm UTC

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