Go learning (compile and run Go programs)

1. Create a go file hello.go and
enter the following code

package main
import "fmt"
func main(){
    
    
    fmt.Println("Hello")
}

2. Switch to the directory where the file is located and
run it directly with the go run command

go run hello.go

Or
compile first to generate a hello binary file, and then run through ./hello

go build hello.go
./hello

Guess you like

Origin blog.csdn.net/rj2017211811/article/details/110654535