学習に行く(Goプログラムをコンパイルして実行する)

1. goファイルhello.goを作成し
、次のコード入力します

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

2.ファイルが配置されているディレクトリに切り替え
、gorunコマンドを使用して直接実行します。

go run hello.go

または
、最初にコンパイルしてhelloバイナリファイルを生成してから、。/ helloを実行します。

go build hello.go
./hello

おすすめ

転載: blog.csdn.net/rj2017211811/article/details/110654535