雑草SEの備忘録

東大を卒業し、SEとして働くことになった。備忘録的に作業を綴る。

Goならわかるシステムプログラミング 14.2.9のReactiveXでpackageのインストールし忘れがち問題

前々回の記事に引き続き、Goならわかるシステムプログラミングの写経を行なっています。



Goならわかるシステムプログラミング

  • 作者: 渋川よしき
  • 出版社/メーカー: Lambda Note
  • 発売日:2017/10/19

何も考えず実行すると、こんな形でエラーが出てきます。

main.go:9:2: cannot find package "github.com/reactivex/rxgo/observable" in any of:
	/usr/local/Cellar/go/1.10.3/libexec/src/github.com/reactivex/rxgo/observable (from $GOROOT)
	/Users/username/go/src/github.com/reactivex/rxgo/observable (from $GOPATH)
main.go:8:2: cannot find package "github.com/reactivex/rxgo/observer" in any of:
	/usr/local/Cellar/go/1.10.3/libexec/src/github.com/reactivex/rxgo/observer (from $GOROOT)
	/Users/username/go/src/github.com/reactivex/rxgo/observer (from $GOPATH)

これは単純にpackageがインストールされていないだけで、

go get -u github.com/reactivex/rxgo

を実行すればエラーが解消されるはずです。

RactiveXのREADEMEに書いてある通りですね。

github.com