無法辨識 GoMobile 工具(Golang)

無法辨識 GoMobile 工具(Golang)

安裝時Golang行動工具在我的 Windows10-64 位元機器上,無法辨識 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”放入環境路徑中。

相關內容