スポンサーリンク

Windows8.1でVisualStudioCodeでGolang

Go言語をやるのに、エディタはAtomを使っていた。

Atomも悪くはないのだが、Visual Studio Codeというエディタがあると聞いたので、試してみた。なお、以下の記事にて、Go 1.7.1をインストール済み。

Windowsでgolang(1)Go(1.7.1)とRevel(v0.13.1)のインストール

(環境)
Windows8.1
Go 1.7.1
Revel v0.13.1

GOPATH C:\Go\Projects
GOROOT C:\Go
PATH C:\Go\Projects\bin

(1)以下のサイトからダウンロードしてインストール

https://code.visualstudio.com/

image

image

VSCodeSetup-stable.exe をダウンロード

30MBなのに7分!?サーバが重いのか?

ダウンロードしたVSCodeSetup-stable.exe ををダブルクリックしてインストール

image

一応、こういう設定にしておいた。

image

image

image

image

image

(2)以下を参考に、試してみる

http://dev.classmethod.jp/go/visual-studio-code-golang-debug/

http://qiita.com/qt-luigi/items/1e73c2e129c408c16cbf

Go言語Extensionのインストール

MicrosoftのGithubリポジトリで提供されているvscode-goをインストール

[cmd+shift+p]でコマンドパレットを開き、install と入力して、[Extensions: Install Extension]を実行

image

Go (lukehoan) をインストール

image

image

有効 をクリック

image

image

以下、

http://qiita.com/qt-luigi/items/1e73c2e129c408c16cbf#%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3

を参考に設定を行う。

(3)ファイル > 基本設定 > ユーザー設定

image

(変更前)
image

(変更後1)
image

(変更後2)
image

(4)hello.go を試してみる。

http://golang-jp.org/
image

のコードをコピペ。

// You can edit this code!
// Click here and start typing.
package main

import "fmt"

func main() {
    fmt.Println("Hello, 世界")
}

 

[sourcecode language=”xml” padlinenumbers=”true”]
// You can edit this code!
// Click here and start typing.
package main

import "fmt"

func main() {
fmt.Println("Hello, 世界")
}
[/sourcecode]

image

image

image

だいぶ時間がかかる

image

image

全部で5分から10分くらいかかった。

表示 > 統合ターミナル(Ctrl + @)

とすると、cmd.exe 相当のものが現れるので、

image

cd c:\godev\vscode
go run hello.go

image

無事、Hello world! が表示された。これ、もしかしたら使いやすいかも。。。

スポンサーリンク

golang

Posted by twosquirrel