0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS7でGoのHelloWorldを動かす手順

Posted at

Go言語の公式ページにあるHelloWorldをCentOS7で実行してみます。

実行環境

こちらで構築しました。

実装準備

ソースを保存するディレクトリを作成します。

$ mkdir -p ~/go/src/hello

実装

$ vim ~/go/src/hello/hello.go

hello.go
package main

import "fmt"

func main() {
	fmt.Printf("hello, world\n")
}

ビルド

$ cd ~/go/src/hello
$ go build
$ ls
hello  hello.go

hello(実行ファイル)ができました。

実行

$ ~/go/src/hello/hello
hello, world

hello, world が出力されました。

後始末

作成した実行ファイルを消します。

$ cd ~/go/src/hello
$ go clean -i
$ ls
hello.go

以上です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?