Hi everybody,
I am getting started with Go and would like to test to print table content to the console using a github project. I already have git installed and imported the module using:
git clone https://github.com/jedib0t/go-pretty.git
When I copy the code in the example of the documentation and store it as main.go I have the following code in VSC:
package main
import (
“os”
"github.com/jedib0t/go-pretty/table"
)
func main() {
t := table.NewWriter()
t.SetOutputMirror(os.Stdout)
t.AppendHeader(table.Row{"#", “First Name”, “Last Name”, “Salary”})
t.AppendRows([]table.Row{
{1, “Arya”, “Stark”, 3000},
{20, “Jon”, “Snow”, 2000, “You know nothing, Jon Snow!”},
})
t.AppendRow([]interface{}{300, “Tyrion”, “Lannister”, 5000})
t.AppendFooter(table.Row{"", “”, “Total”, 10000})
t.Render()
}
When I try to run this code using the terminal : go run main.go
I get the following error:
cannot find package “github.com/jedib0t/go-pretty/table”
I think it must be something small but I am completely stuck.
Any tips you might have would be very much appreciated.
Thanks
Peter