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”。

相关内容