[Go] #NI6 failing for #IP1

I’m stuck on Stage #NI6 after completing #IP1.

I’ve tried editing the function that prints out the required command (including commenting out the section that causes the error). However the logs in the test show that the command still produced erroneous output twice. Additional context- the command that prints the info is called VerboseCommand. First time trying out Go but I assume the issue is the build process as it seems to be fine on my end.

Here are my logs:

[tester::#IP1] Running tests for Stage #IP1 (Run a program)
[tester::#IP1] [setup] export PATH=/tmp/quz:$PATH
[tester::#IP1] [setup] Available executables:
[tester::#IP1] [setup] - custom_exe_7889
[tester::#IP1] Running ./your_program.sh
[your-program] $ custom_exe_7889 Alice
[your-program] Program was passed 2 args (including program name).
[your-program] Arg #0 (program name): custom_exe_7889
[your-program] Arg #1: Alice
[your-program] Program was passed 2 args (including program name).
[tester::#IP1] Output does not match expected value.
[tester::#IP1] Expected: "Program Signature: 3435202340"
[tester::#IP1] Received: "Program was passed 2 args (including program name)."
[your-program] Arg #0 (program name): /tmp/quz/custom_exe_7889
[your-program] Arg #1: Alice
[your-program] Program Signature: 3435202340
[your-program] $ 
[tester::#IP1] Assertion failed.
[tester::#IP1] Test failed

And here’s a snippet of my code:

func VerboseCommand(commandList []string) {
	fmt.Fprintf(os.Stdout, "Program was passed %d args (including program name).\n", len(commandList))
	for num, each := range commandList {
		if num == 0 {
			if strings.ContainsRune(each, '/') || strings.ContainsRune(each, '\\') {
				var progName string
				var pathList []string
				operatingSystem := runtime.GOOS
				switch operatingSystem {
				case "windows":
					pathList = strings.SplitAfterN(each, "\\", 1)
				case "linux":
					pathList = strings.Split(each, "/")
				default:
					pathList = strings.Split(each, "/")
				}
				progName = pathList[len(pathList)-1]
				fmt.Fprintf(os.Stdout, "Arg #0 (program name): %s\n", progName)
			}
			fmt.Fprintf(os.Stdout, "Arg #0 (program name): %s\n", commandList[0])
			continue
		}
		fmt.Fprintf(os.Stdout, "Arg #%d: %s\n", num, each)
	}
}

Link to the code at challenge-commit: goTerm/cmd/myshell/main.go at 7b6213e78093ca378deab7f121b0dd9f660195b2 · pranavm7/goTerm · GitHub

I’ll take a look and get back to you by the end of the week.

@andy1li Appreciate the prompt response, it seems like I was able to get it to pass, but the debug output still shows the verbose output even after the VerboseCommand func has been commented out.
Following is a link to the commit that is passing:

Still believe it is an interesting bug in the tester’s execution of my code, please let me know if I can be of more help.

but the debug output still shows the verbose output even after the VerboseCommand func has been commented out.

@pranavm7 The issue you described could be due to a potential caching bug in our tester. However, I wasn’t able to reproduce it when running the latest version of your code from GitHub.

Could you share the steps to reproduce the issue on your end? Thanks!

Hey @andy1li ! I didn’t really do anything else other than running codecrafters test (bug existed with --previous as well). I wouldn’t know how to reproduce it, but once you’re run the test on my code a bunch of times, even if you comment out the call to VerboseCommand it should execute afaik.