下载源码:

1
2
3
4
5
6
7
8
gopm get -g -d -v golang.org/x/mobile/cmd/gomobile
[GOPM] 03-09 17:32:42 [ INFO] App Version: 0.8.8.0307 Beta
[GOPM] 03-09 17:32:42 [ INFO] Local repository path: /Users/scue/.gopm/repos
[GOPM] 03-09 17:32:42 [ INFO] Indicated GOPATH: /Users/scue/go
[GOPM] 03-09 17:32:42 [ INFO] /Users/scue/.gopm/repos/golang.org/x/mobile
[GOPM] 03-09 17:32:42 [DEBUG] Skipped installed package: golang.org/x/mobile/cmd/gomobile@branch:<UTD>
[GOPM] 03-09 17:32:42 [ INFO] Package copied to GOPATH: golang.org/x/mobile
[GOPM] 03-09 17:32:42 [ INFO] 0 package(s) downloaded, 0 failed

需要添加上一个-g|--gopath以下载至自己的GOPATH环境变量内,否则会下载至~/.gopm/repos

安装二进制文件:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
gopm bin -v -d ~/go/bin golang.org/x/mobile/cmd/gomobile
[GOPM] 03-09 17:34:57 [ INFO] App Version: 0.8.8.0307 Beta
[GOPM] 03-09 17:34:57 [ INFO] Local repository path: /Users/scue/.gopm/repos
[GOPM] 03-09 17:34:57 [ INFO] Indicated GOPATH: /Users/scue/go
[GOPM] 03-09 17:34:57 [ INFO] /Users/scue/.gopm/repos/golang.org/x/mobile
[GOPM] 03-09 17:34:57 [DEBUG] Skipped installed package: golang.org/x/mobile/cmd/gomobile@branch:<UTD>
[GOPM] 03-09 17:34:57 [DEBUG] Linking golang.org/x/mobile...
[GOPM] 03-09 17:34:57 [DEBUG] Loading dependencies...
[GOPM] 03-09 17:34:57 [ INFO] Installing...
[GOPM] 03-09 17:34:57 [ INFO] Setting GOPATH to /Users/scue/.gopm/.vendor
[GOPM] 03-09 17:34:57 [ INFO] ===== application outputs start =====

golang.org/x/mobile/internal/importers
golang.org/x/mobile/internal/binres
golang.org/x/mobile/internal/importers/objc
golang.org/x/mobile/internal/importers/java
golang.org/x/mobile/bind
golang.org/x/mobile/cmd/gomobile
[GOPM] 03-09 17:34:59 [ INFO] ====== application outputs end ======
[GOPM] 03-09 17:34:59 [ INFO] Setting GOPATH back to /Users/scue/go:/usr/local/go
[GOPM] 03-09 17:34:59 [ INFO] Copying resources to /Users/scue/go/bin
[GOPM] 03-09 17:34:59 [ INFO] Command executed successfully!
Binary has been built into: /Users/scue/go/bin

需要指定一下-v ~/go/bin才会安装至GOPATH里边,否则会安装至~/.gopm/repos