Go run environment not working

I am just trying to get started with learning go but whenever I try to run code in Visual Studios Code I get this error

Hi! You have to define your main.go (main can be whatever name you want) in this example form:

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

Just to clarify: The “main” in the filename: “main.go” can be whatever you want (e.g. myprogram.go), but the main in func main() { must be main.

2 Likes

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