GoMobile ツールが認識されない (Golang)

GoMobile ツールが認識されない (Golang)

インストールについてGolang モバイルツール私のWindows10-64bitマシンでは、gomobileツールが認識されません。インストールパスはGOROOT パス C:\Go

Goバージョン:-go1.11.5 Windows/amd64私のマシンにインストールされています。

Golang モバイル ツールを動作させる方法を教えてください。

PS C:\Go>  go get golang.org/x/mobile/cmd/gomobile
PS C:\Go>  gomobile init
gomobile : The term 'gomobile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path 
was included, verify that the path is correct and try again.
At line:1 char:2
+  gomobile init
+  ~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (gomobile:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Go> gomobile version
gomobile : The term 'gomobile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path 
was included, verify that the path is correct and try again.
At line:1 char:1
+ gomobile version
+ ~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (gomobile:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Go> go version
go version go1.11.5 windows/amd64

答え1

Gomobile ツールは、環境/システム変数で提供される参照 GOPATH および GOROOT パスを使用してインストールします。

正しいパスが提供されるように注意する必要があり、新しい GoVersion をインストールするときには、すべての古いパス (もはや有効ではないパス) を削除する必要があります。

上記の手順に従い、Gomobile ツールをインストール用の GOPATH にポイントすると、gomobile ツールは正常に動作します。

また、環境パスに「gomobile」を入れる必要はありません。

関連情報