Getting absolute paths

Report a typo

Emma wants to create a very simple program. It should take as input a string containing a certain path, and then it should use the correct function from the filepath package to return a string with the absolute representation of the path and an error.

Below is the code Emma has written so far:

Sample Input 1:

among_us/impostor.png

Sample Output 1:

/sandbox/among_us/impostor.png
Write a program in Go
package main

import (
"fmt"
"log"
"path/filepath"
)

func main() {
// DO NOT delete these two lines! they take a certain 'path' as an input
var path string
fmt.Scanln(&path)

// Help Emma call the correct function from the filepath pkg below to properly get an "absolute path":
?, err := ?.?(?)
if err != nil {
log.Fatal(err)
}
// Output the absolute path below:
fmt.Println(?)
}
___

Create a free account to access the full topic