LoginSignup
1
0

More than 5 years have passed since last update.

cobraをWindowsで使ったときにはまった、たった一つのこと

Last updated at Posted at 2016-10-28

Cobraとは

GoでCLI作成の心強い味方
https://github.com/spf13/cobra

どこではまったか

ある日私はWindowsでCobraを使って、CLIツールを作ろうと思い立った。しかし、どうしても、 cobra init する時に

Error: Cobra only supports project within $GOPATH

という無慈悲なエラーが出て動かない。
コードを見、エラー箇所を見つけ、printデバッグを試してみると、パスの比較をしているところで、パス名の最初のドライブレターが、片方は大文字、片方は小文字であった。

なるほどと思った私は、おもむろにコントロールパネルを開くと、「システム」>「システムの詳細設定」で、環境変数の指定でGOPATHの最初のcをCとし、心の平安を得たのであった。

教訓

*NIX環境を前提としているであろうツールをWindowsで動かすときはファイルパスが鬼門

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