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