LoginSignup
0
1

More than 3 years have passed since last update.

VScodeでGo開発環境のセットアップ(Ubuntu18.04)

Posted at

環境

バージョン: 1.41.1
コミット: 26076a4de974ead31f97692a0d32f90d735645c0
日付: 2019-12-18T15:04:31.999Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Linux x64 4.15.0-76-generic

拡張機能のインストール

Extensions から Goインストール
Ctrl+Shift+Pでコマンドパレットを開いて、GO: Install/Update toolsを実行
全ツールを選択してインストール

サンプルコード

package main

import (
    "fmt"
)

func main() {
    fmt.Println("hello world.")
    i := 101
    fmt.Println(i)
}

はまったこと

デバッグ実行したらなんか怒られた。

version of go is too old for this version of delve (minimum supported version 1.11, suppress this error with --check-go-version=false)

色々調べると、aptでgolangをインストールすると1.10が入るっぽく、
delveは1.11以上を要求するのでデバッグできないみたい。

https://golang.org/doc/install?download=go1.13.7.linux-amd64.tar.gz
ここを参考に手動で1.11以上のVersionを入れてPATHを通す。

tar -C /usr/local -xzf go1.13.7.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin

うごいたー!!

1.jpg

おわり。

0
1
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
1