GoMobile-Tools werden nicht erkannt (Golang)

GoMobile-Tools werden nicht erkannt (Golang)

Zur InstallationMobile Tools für Golangauf meinem Windows10-64bit-Rechner werden die Gomobile-Tools nicht erkannt. Der Installationspfad ist derGOROOT-PFAD C:\Go.

GoVersion: -go1.11.5 Windows/AMD64ist auf meinem Computer installiert.

Bitte lassen Sie mich wissen, wie ich die mobilen Golang-Tools zum Laufen bekomme.

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

Antwort1

Die Gomobile-Tools verwenden für die Selbstinstallation die in den Umgebungs-/Systemvariablen bereitgestellten Referenzpfade GOPATH und GOROOT.

Es muss darauf geachtet werden, dass die richtigen Pfade angegeben werden und bei einer Neuinstallation von GoVersion alle alten Pfade (die nicht mehr gültig sind) gelöscht werden.

Wenn Sie die oben genannten Schritte befolgen und die Gomobile-Tools zur Installation auf GOPATH verweisen, funktionieren die Gomobile-Tools einwandfrei.

Außerdem ist es nicht erforderlich, „gomobile“ in den Umgebungspfad einzufügen.

verwandte Informationen