LoginSignup
4
5

More than 5 years have passed since last update.

Golang のインスコでハマった件

Last updated at Posted at 2015-06-21

比較的インストールが楽なLinuxでドハマりしたのでメモっておきます。
ものすごい間違ってるかもしれませんがそこら辺は御愛嬌。

1. このあたりを読みながら適当にインスコしてみた

Installing Golang and Hello World in linux mint

2. インストール祭り。色々ぶっこみ始める。

Gore(interactive shell)
=> REPL。 日本製らしい。
Delve
=> デバッガー。「普段使いには向きませんよ」と書かれた新し目のデバッガー
Hsandbox
=> REPLっぽいもの。GOだけじゃなくRUBYなど様々な言語に対応。エディタにコードを入れるて保存すると下画面で実行してくれる。コードのメモ書きアプリみたいな感じ。超スゴイ。

などをインストール

3. うごかなくなる

なんだか知らないけどGoreがパスがうまく動かないのか動いたり動かなかったり。
Delveもパスが通ってないのか呼べたり呼べなかったり。
で、こんなエラーが出てHsandboxからGoが呼べなかったり。

bin/sh 1: go: not found

だのになぜだか go そのものは動いているという・・・・(コードの実行は問題ない)

4. 色々やって諦める

もういいじゃんコードは動くんだからさ。俺みてぇな初心者にツールなんかいらねぇよ!と諦めモード。

5. 衝撃の事実

apt-get使えたんスか・・・・そうスか・・・・
こういう時はやり直したほうが早い。原因の究明とかそっちのけで、goをフォルダごと削除。

6. しばらくしてバージョンが1.2なことに気がつく

Gitみたら似たようなお話ががががが
debian: package version installed by apt-get #10095

Golang debian package installed by sudo apt-get install golang installes version 1.1.2, whereas the current version is 1.4.2.

Can anybody confirm this, and if it is really the case can you please update the repository?

thanks.

意訳: 俺のGolangがapt-getで入れたのに最新の1.4.2じゃなくて1.1.2が入ってる件
We don't have any control over the Debian repositories. You need to bring this up with the Debian maintainers.

Also I think it matters which version of Debian you are using. You didn't mention that.  

意訳:メンテやってる中の人に聞けば?

Jessie (testing) has 1.3.3 and it's currently frozen, so even if you wait for the next Stable release you'll get 1.3. Not even Sid (unstable) has 1.4 at the moment.

You can get the latest binary on golang.org, it works just fine on debian.

意訳: あー、それもうメンテされてねぇわ。公式逝け。(;´Д`)
If you want to automate the process of installing from the tarballs here is a fragment of script I originally wrote for the Raspberry Pi. Just use the appropriate URL to get the correct tarball.

意訳: つ俺が使ったインスコ用スクリプト
(以下スクリプト)
wget -O - https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | sudo tar -xzC /usr/local -f -

echo '# Setup for golang' |sudo tee /etc/profile.d/golang.sh
echo 'PATH=$PATH:/usr/local/go/bin'|sudo tee -a /etc/profile.d/golang.sh

source /etc/profile.d/golang.sh
An inoffical ubuntu package (so called PPA) is at https://launchpad.net/~evarlast/+archive/ubuntu/golang1.4

Currently debian sid is frozen, so nothing can be added there either.
If you want to follow the progress, watch https://tracker.debian.org/pkg/golang

意訳: 非公式パッケでいいならでいいならここ  
   (https://launchpad.net/~evarlast/+archive/ubuntu/golang1.4)
   いけばダウソできるお。

で、そのURLへ・・・
golang 1.4

add-apt-repository してと・・・・
sudo apt-get install golangやったらアップデート出来ました。

8. パスの件

GOPATHを指定して。pkg, src, binを作ります。

go get github.com/some-app

ってやるとbinにファイルができるから、
それを

which go

ってやって出てきたパス(GOROOT)に、シンボリックリンクを入れてあげればいいんですね。

  sudo -s ln /home/my_folder/golang/bin/dlv /usr/bin

みたいな感じ

動かなかったものが、一応全部動いてる感じです。やれやれ。

補足

そういえばGolangってゴウランガと似てますね。
ヘッズ向きの言語化もしれませんね
それでは

オタッシャデー!!

4
5
1

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
4
5