├── .gitignore ├── LICENSE ├── README.md ├── en-US ├── Bin.md ├── Build.md ├── Gen.md ├── Get.md ├── Install.md ├── Quickstart.md ├── README.md ├── Run.md ├── Update.md ├── clean.md ├── gopmfile.md ├── list.md └── test.md ├── images └── arch.png ├── pkgname.list └── zh-CN ├── Bin.md ├── Build.md ├── Gen.md ├── Get.md ├── Install.md ├── Quickstart.md ├── README.md ├── Run.md ├── Update.md ├── clean.md ├── gopmfile.md ├── list.md └── test.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | .DS_Store 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Go Package Manager Documentation 2 | ==== 3 | 4 | An open source project for documentation of [gopm](https://github.com/gpmgo/gopm) - Go Package Manager. 5 | 6 | ## Languages 7 | 8 | - [English](en-US/README.md) 9 | - [简体中文](zh-CN/README.md) 10 | 11 | ## Feedback 12 | 13 | Any question or anything unclear, you're welcome to open an issue. 14 | 15 | -------------------------------------------------------------------------------- /en-US/Bin.md: -------------------------------------------------------------------------------- 1 | Command bin 2 | =========== 3 | 4 | Help information: `gopm bin -h` or `gopm help bin`: 5 | 6 | ``` 7 | NAME: 8 | bin - download and link dependencies and build binary 9 | 10 | USAGE: 11 | command bin [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command bin downloads and links dependencies according to gopmfile, 15 | and build executable binary to work directory 16 | 17 | gopm bin @[:] 18 | gopm bin @[:] 19 | 20 | Can only specify one each time, and only works for projects that 21 | contain main package 22 | 23 | OPTIONS: 24 | --tags apply build tags 25 | --dir, -d './' build binary to given directory 26 | --update, -u update pakcage(s) and dependencies if any 27 | --remote, -r build with pakcages in gopm local repository only 28 | --verbose, -v show process details 29 | ``` 30 | 31 | ### `gopm bin @[:]` 32 | 33 | - Feature: Download and link dependencies and build executable binary according to specified version. 34 | - Detail: Download given package and just get binary without bothering any source code manually. 35 | - Example: 36 | - Latest version: `gopm bin github.com/gpmgo/gopm`. 37 | - Certain branch: `gopm bin github.com/gpmgo/gopm@branch:master`. 38 | - Specified tag: `gopm bin github.com/gpmgo/gopm@tag:v0.1.0`. 39 | - Fixed commit: `gopm bin github.com/gpmgo/gopm@commit:23ce93a`. 40 | 41 | #### Usage example 42 | 43 | In case you want to build binary to specified path, you can use option `--dir, -d` to achieve that. For example, I want to build gopm to `$GOROOT/bin`, then I should execute `gopm bin -d $GOROOT/bin github.com/gpmgo/gopm`. 44 | 45 | ##### Latest version: `gopm bin github.com/gpmgo/gopm` 46 | 47 | This downloads the latest version of gopm and build it into work directory. 48 | 49 | ##### Certain branch: `gopm bin github.com/gpmgo/gopm@branch:master` 50 | 51 | This downloads the latest version of gopm in master branch and build it into work directory. 52 | 53 | ##### Specified tag: `gopm bin github.com/gpmgo/gopm@tag:v0.1.0` 54 | 55 | This downloads the version of gopm in `tag:v0.1.0` and build it into work directory. 56 | 57 | ##### Fixed commit: `gopm bin github.com/gpmgo/gopm@commit:23ce93a` 58 | 59 | This downloads the version of gopm in `commit:23ce93a` and build it into work directory. 60 | 61 | ### `gopm bin @[:]` 62 | 63 | - Feature: Download and link dependencies and build executable binary according to specified version; but instead of using full import path, use project name. 64 | - Detail: It's basically a short-cut for package import path. 65 | - Example: 66 | - Latest version: `gopm bin gopm`. 67 | - Certain branch: `gopm bin gopm@branch:master`. 68 | - Specified tag: `gopm bin gopm@tag:v0.1.0`. 69 | - Fixed commit: `gopm bin gopm@commit:23ce93a`. 70 | 71 | See [well-known Go projects list](../pkgname.list) for details. 72 | 73 | ## Options 74 | 75 | - `--tags`: apply build tags. 76 | - `-dir, -d`: build binary to given directory. 77 | - `--update, -u`: update pakcage(s) and dependencies if any. 78 | - `--verbose, -v`: show process details. -------------------------------------------------------------------------------- /en-US/Build.md: -------------------------------------------------------------------------------- 1 | Command build 2 | ============= 3 | 4 | Help information: `gopm build -h` or `gopm help build`: 5 | 6 | ``` 7 | NAME: 8 | build - link dependencies and go build 9 | 10 | USAGE: 11 | command build [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command build links dependencies according to gopmfile, 15 | and execute 'go build' 16 | 17 | gopm build 18 | 19 | OPTIONS: 20 | --tags apply build tags 21 | --update, -u update pakcage(s) and dependencies if any 22 | --remote, -r build with pakcages in gopm local repository only 23 | --verbose, -v show process details 24 | ``` 25 | 26 | ### `gopm build ` 27 | 28 | - Feature: Link dependencies according to gopmfile and go build. 29 | - Detail: Downloads missing dependencies and link them then build binary for current project. 30 | - Example: `gopm build`. 31 | 32 | ## Options 33 | 34 | - `--tags`: apply build tags. 35 | - `--update, -u`: update pakcage(s) and dependencies before building. 36 | - `--verbose, -v`: show process details. -------------------------------------------------------------------------------- /en-US/Gen.md: -------------------------------------------------------------------------------- 1 | Command gen 2 | =========== 3 | 4 | Help information: `gopm gen -h` or `gopm help gen`: 5 | 6 | ``` 7 | NAME: 8 | gen - generate a gopmfile for current Go project 9 | 10 | USAGE: 11 | command gen [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command gen gets dependencies and generates a gopmfile 15 | 16 | gopm gen 17 | 18 | Make sure you run this command in the root path of a go project. 19 | 20 | OPTIONS: 21 | --tags apply build tags 22 | --local, -l generate local GOPATH directories 23 | --verbose, -v show process details 24 | ``` 25 | 26 | ### `gopm gen` 27 | 28 | - Feature: Generate a gopmfile according current Go project. 29 | - Detail: Get dependencies and list in the gopmfile. 30 | - Example: `gopm gen`. 31 | 32 | #### Usage example 33 | 34 | I'm now under `$GOPATH/src/github.com/gogits/gogs`, and I want to generate a gopmfile: 35 | 36 | $ gopm gen 37 | $ cat .gopmfile 38 | 39 | Output: 40 | 41 | ``` 42 | [target] 43 | path = github.com/gogits/gogs 44 | 45 | [deps] 46 | github.com/beego/memcache = commit:2aea774416 47 | github.com/beego/redigo = commit:856744a0d5 48 | github.com/Unknwon/cae = commit:2e70a1351b 49 | github.com/Unknwon/com = commit:2cbcbc6916 50 | github.com/Unknwon/goconfig = commit:0f8d8dc1c0 51 | github.com/Unknwon/i18n = commit:47baeff8d0 52 | github.com/Unknwon/macaron = 53 | github.com/codegangsta/cli = commit:7381bc4e62 54 | github.com/go-sql-driver/mysql = commit:8111ee3ec3 55 | github.com/go-xorm/core = commit:750aae0fa5 56 | github.com/go-xorm/xorm = commit:2d8b3135b1 57 | github.com/gogits/gfm = commit:40f747a9c0 58 | github.com/gogits/oauth2 = commit:99cbec870a 59 | github.com/lib/pq = commit:b021d0ef20 60 | github.com/macaron-contrib/cache = commit:204d8e5137 61 | github.com/macaron-contrib/captcha = 62 | github.com/macaron-contrib/csrf = 63 | github.com/macaron-contrib/i18n = 64 | github.com/macaron-contrib/session = 65 | github.com/macaron-contrib/toolbox = commit:57127bcc89 66 | github.com/mattn/go-sqlite3 = commit:a80c27ba33 67 | github.com/nfnt/resize = commit:581d15cb53 68 | github.com/saintfish/chardet = commit:3af4cd4741 69 | 70 | [res] 71 | include = conf|etc|public|scripts|templates 72 | ``` 73 | 74 | More information about how to write versions, please see [gopmfile](gopmfile.md). 75 | 76 | ## Options 77 | 78 | - `--tags`: apply build tags when list dependencies. 79 | - `--verbose, -v`: show process details. 80 | -------------------------------------------------------------------------------- /en-US/Get.md: -------------------------------------------------------------------------------- 1 | Command get 2 | =========== 3 | 4 | Help information: `gopm get -h` or `gopm help get`: 5 | 6 | ``` 7 | NAME: 8 | get - fetch remote package(s) and dependencies 9 | 10 | USAGE: 11 | command get [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command get fetches a package or packages, 15 | and any package that it or they depend(s) on. 16 | If the package has a gopmfile, the fetch process will be driven by that. 17 | 18 | gopm get 19 | gopm get @[:] 20 | gopm get @[:] 21 | 22 | Can specify one or more: gopm get cli@tag:v1.2.0 github.com/Unknwon/macaron 23 | 24 | If no version specified and package exists in GOPATH, 25 | it will be skipped, unless user enabled '--remote, -r' option 26 | then all the packages go into gopm local repository. 27 | 28 | OPTIONS: 29 | --tags apply build tags 30 | --download, -d download given package only 31 | --update, -u update package(s) and dependencies if any 32 | --local, -l download all packages to local GOPATH 33 | --gopath, -g download all packages to GOPATH 34 | --remote, -r download all packages to gopm local repository 35 | --verbose, -v show process details 36 | ``` 37 | 38 | ### `gopm get` 39 | 40 | - Feature: Fetch remote package(s) and dependencies to local repository according to gopmfile. 41 | - Detail: No argument means get dependencies for project that is in work directory, if a gopmfile is supplied, then will get based on the information from gopmfile. 42 | - Example: `gopm get`. 43 | 44 | #### Usage example 45 | 46 | ##### `gopm get` 47 | 48 | Suppose your work directory is in the project of gopm(`github.com/gpmgo/gopm`): 49 | 50 | $ pwd 51 | 52 | Output: 53 | 54 | $GOPATH/src/github.com/gpmgo/gopm 55 | 56 | And there is a gopmfile: 57 | 58 | $ cat .gopmfile 59 | 60 | Output: 61 | 62 | ``` 63 | [target] 64 | path = github.com/gpmgo/gopm 65 | 66 | [deps] 67 | github.com/Unknwon/com = 68 | github.com/Unknwon/goconfig = 69 | github.com/aybabtme/color = 70 | github.com/codegangsta/cli = 71 | github.com/Unknwon/cae = 72 | ``` 73 | 74 | So the command will downloads 4 packages(into gopm local repository `~/.gopm/repos`) in `deps` section if there do not exist in your `$GOPATH`. 75 | 76 | Suppose you need to download them all into your `$GOPATH` so you may able to make some changes and then compile gopm. Use option `--gopath, -g` to achieve that. 77 | 78 | However, in case you want to keep your `$GOPATH` clean and download all of them into gopm local repository. Use option `--remote, -r` to achieve that. 79 | 80 | ### `gopm get @[:]` 81 | 82 | - Feature: Fetch remote package(s) and dependencies to local repository according to specified version. 83 | - Detail: This command can accept one or more import paths with/without specified version. 84 | - Example: 85 | - Latest version: `gopm get github.com/go-xorm/xorm`. 86 | - Certain branch: `gopm get github.com/go-xorm/xorm@branch:master`. 87 | - Specified tag: `gopm get github.com/go-xorm/xorm@tag:v0.2.3`. 88 | - Fixed commit: `gopm get github.com/go-xorm/xorm@commit:6ffffe9`. 89 | 90 | #### Usage example 91 | 92 | ##### Latest version: `gopm get github.com/go-xorm/xorm` 93 | 94 | This downloads the latest version of xorm, and its dependencies according to its gopmfile. 95 | 96 | ##### Certain branch: `gopm get github.com/go-xorm/xorm@branch:master` 97 | 98 | This downloads the latest version of xorm in master branch, and its dependencies according to its gopmfile. 99 | 100 | ##### Specified tag: `gopm get github.com/go-xorm/xorm@tag:v0.2.3` 101 | 102 | This downloads the version of xorm in `tag:v0.2.3`, and its dependencies according to its gopmfile. 103 | 104 | ##### Fixed commit: `gopm get github.com/go-xorm/xorm@commit:6ffffe9` 105 | 106 | This downloads the version of xorm in `commit:6ffffe9`, and its dependencies according to its gopmfile. 107 | 108 | ### `gopm get @[:]` 109 | 110 | - Feature: Fetch remote package(s) and dependencies to local repository according to specified version; but instead of using full import path, use project name. 111 | - Detail: It's basically a short-cut for package import path. 112 | - Example: 113 | - Latest version: `gopm get xorm`. 114 | - Certain branch: `gopm get xorm@branch:master`. 115 | - Specified tag: `gopm get xorm@tag:v0.2.3`. 116 | - Fixed commit: `gopm get xorm@commit:6ffffe9`. 117 | 118 | See [well-known Go projects list](../pkgname.list) for details. 119 | 120 | ## Options 121 | 122 | - `--tags`: apply build tags. 123 | - `--download, -d`: download given package only. 124 | - `--update, -u`: update package(s) and dependencies if any. 125 | - `--gopath, -g `: download all packages to GOPATH. 126 | - `--remote, -r`: download all packages to gopm local repository. 127 | - `--verbose, -v`: show process details. 128 | -------------------------------------------------------------------------------- /en-US/Install.md: -------------------------------------------------------------------------------- 1 | Command install 2 | =============== 3 | 4 | Help information: `gopm install -h` or `gopm help install`: 5 | 6 | ``` 7 | NAME: 8 | install - link dependencies and go install 9 | 10 | USAGE: 11 | command install [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command install links dependencies according to gopmfile, 15 | and execute 'go install' 16 | 17 | gopm install 18 | 19 | If no argument is supplied, then gopmfile must be present 20 | 21 | OPTIONS: 22 | --tags apply build tags 23 | --remote, -r build with pakcages in gopm local repository only 24 | --verbose, -v show process details 25 | ``` 26 | 27 | ### `gopm install` 28 | 29 | - Feature: Link dependencies according to gopmfile for current project and go install. 30 | - Detail: Download missing dependencies then link and install them. 31 | - Example: `gopm install`. 32 | 33 | ### `gopm install ` 34 | 35 | - Feature: Link dependencies according to gopmfile of given import path and go install. 36 | - Detail: Download missing dependencies then link and install them. 37 | - Example: `gopm install github.com/Unknwon/com`. 38 | 39 | ## Options 40 | 41 | - `--tags`: apply build tags. 42 | - `-verbose`: show process details. -------------------------------------------------------------------------------- /en-US/Quickstart.md: -------------------------------------------------------------------------------- 1 | Quick Start 2 | =========== 3 | 4 | In this section, we're going to demonstrate a simple usage of gopm, which uses two different versions of beego then prints the version of beego in the application. 5 | 6 | ## Setup 7 | 8 | You do not have to put this project under `$GOPATH`, so let's pick `~/demo` as our project root path: 9 | 10 | $ mkdir ~/demo 11 | $ cd ~/demo 12 | 13 | Now, create a `main.go`: 14 | 15 | $ touch main.go 16 | 17 | Copy and paste following code: 18 | 19 | ```go 20 | package main 21 | 22 | import ( 23 | "github.com/astaxie/beego" 24 | ) 25 | 26 | func main() { 27 | println("Beego version:", beego.VERSION) 28 | } 29 | ``` 30 | 31 | Well done! 32 | 33 | ## gopmfile 34 | 35 | This file contains all the information that gopm needs, so let's see what we can do in this demo. 36 | 37 | First, create `.gopmfile` in project root path: 38 | 39 | $ touch .gopmfile 40 | 41 | Good, copy and paste the following content into file: 42 | 43 | [target] 44 | path = demo 45 | 46 | Key `path` indicates the project name. 47 | 48 | **ATTENTION** If you're working on the project that has import path like `github.com/gpmgo/gopm`, you should use `path = github.com/gpmgo/gopm` instead of `path = gopm`. 49 | 50 | ## Build 51 | 52 | ### Default 53 | 54 | Let's build with all default setting, which uses all latest version of all dependencies. 55 | 56 | $ gopm build 57 | 58 | If the command executed successfully, nothing will be printed; however, if you want to see details, you can add option `-v` as follows: 59 | 60 | $ gopm build -v 61 | 62 | Following content is a sample output: 63 | 64 | ``` 65 | [GOPM] 14-09-17 17:40:11 [ INFO] Local repository path: /Users/jiahuachen/.gopm/repos 66 | [GOPM] 14-09-17 17:40:11 [ INFO] Indicated GOPATH: /Users/jiahuachen/Applications/Go 67 | [GOPM] 14-09-17 17:40:11 [DEBUG] Linking demo... 68 | [GOPM] 14-09-17 17:40:11 [DEBUG] Loading dependencies... 69 | [GOPM] 14-09-17 17:40:11 [ INFO] Building... 70 | [GOPM] 14-09-17 17:40:11 [ INFO] Setting GOPATH to /Users/jiahuachen/demo/.vendor 71 | [GOPM] 14-09-17 17:40:11 [ INFO] ===== application outputs start ===== 72 | 73 | [GOPM] 14-09-17 17:40:11 [ INFO] ====== application outputs end ====== 74 | [GOPM] 14-09-17 17:40:11 [ INFO] Setting GOPATH back to /Users/jiahuachen/Applications/Go 75 | [GOPM] 14-09-17 17:40:11 [ INFO] Command executed successfully! 76 | ``` 77 | 78 | As you can see, because my `$GOPATH` already has latest version of package beego and its dependencies, and I haven't specified any version, so gopm will not link them. 79 | 80 | Now run it: 81 | 82 | $ ./demo 83 | 84 | And you should see something like: 85 | 86 | beego version: 1.4.0 87 | 88 | ### Customize 89 | 90 | Let's say we want to build with `beego v0.9.0` due to some API breaks, so we want to change our gopmfile to be as follows: 91 | 92 | [target] 93 | path = demo 94 | 95 | [deps] 96 | github.com/astaxie/beego = tag:v0.9.0 97 | 98 | In section `deps`, we indicate beego version to be at `tag:v0.9.0`. 99 | 100 | Download dependency, rebuild our application and run it: 101 | 102 | $ gopm get 103 | $ gopm build 104 | $ ./demo 105 | 106 | Again, you can use `-v` option to see details: 107 | 108 | ``` 109 | [GOPM] 14-09-17 18:07:28 [ INFO] Local repository path: /Users/jiahuachen/.gopm/repos 110 | [GOPM] 14-09-17 18:07:28 [ INFO] Indicated GOPATH: /Users/jiahuachen/Applications/Go 111 | [GOPM] 14-09-17 18:07:28 [DEBUG] Linking demo... 112 | [GOPM] 14-09-17 18:07:28 [DEBUG] Loading dependencies... 113 | [GOPM] 14-09-17 18:07:28 [DEBUG] Linking github.com/astaxie/beego.v0.9.0... 114 | [GOPM] 14-09-17 18:07:28 [DEBUG] Linking github.com/garyburd/redigo... 115 | [GOPM] 14-09-17 18:07:28 [ WARN] Getting imports: no buildable Go source files in /Users/jiahuachen/demo/.vendor/src/github.com/garyburd/redigo 116 | [GOPM] 14-09-17 18:07:28 [ INFO] Building... 117 | [GOPM] 14-09-17 18:07:28 [ INFO] Setting GOPATH to /Users/jiahuachen/demo/.vendor 118 | [GOPM] 14-09-17 18:07:28 [ INFO] ===== application outputs start ===== 119 | 120 | [GOPM] 14-09-17 18:07:29 [ INFO] ====== application outputs end ====== 121 | [GOPM] 14-09-17 18:07:29 [ INFO] Setting GOPATH back to /Users/jiahuachen/Applications/Go 122 | [GOPM] 14-09-17 18:07:29 [ INFO] Command executed successfully! 123 | ``` 124 | 125 | Here gopm downloads three packages for me(into gopm local repository), which are `github.com/astaxie/beego` and `github.com/garyburd/redigo` that I didn't install in my computer, and skipped package `code.google.com/p/vitess/go/memcache` that has been already installed(in my `$GOPATH`). 126 | 127 | This case shows how gopm works well with your `$GOPATH`. 128 | 129 | Now, the output should be: 130 | 131 | Beego version: 0.9.0 132 | 133 | Simple and cool, isn't it? 134 | -------------------------------------------------------------------------------- /en-US/README.md: -------------------------------------------------------------------------------- 1 | Index 2 | ===== 3 | 4 | - [Quick start](Quickstart.md) 5 | - [Command list](list.md) 6 | - [Command gen](Gen.md) 7 | - [Command get](Get.md) 8 | - [Command bin](Bin.md) 9 | - [Command run](Run.md) 10 | - [Command test](test.md) 11 | - [Command build](Build.md) 12 | - [Command install](Install.md) 13 | - [Command clean](clean.md) 14 | - [Command update](Update.md) 15 | - [gopmfile](gopmfile.md) 16 | -------------------------------------------------------------------------------- /en-US/Run.md: -------------------------------------------------------------------------------- 1 | Command run 2 | =========== 3 | 4 | Help information: `gopm run -h` or `gopm help run`: 5 | 6 | ``` 7 | NAME: 8 | run - link dependencies and go run 9 | 10 | USAGE: 11 | command run [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command run links dependencies according to gopmfile, 15 | and execute 'go run' 16 | 17 | gopm run 18 | gopm run -l will recursively find .gopmfile with value localPath 19 | and run the cmd in the .gopmfile, Windows hasn't supported yet, 20 | you need to run the command right at the local_gopath dir. 21 | ``` 22 | 23 | ### `gopm run ` 24 | 25 | - Feature: Link dependencies according to gopmfile and go run. 26 | - Example: `gopm run main.go`. 27 | 28 | ## Options 29 | 30 | - `--tags`: apply build tags. 31 | - `--verbose, -v`: show process details. -------------------------------------------------------------------------------- /en-US/Update.md: -------------------------------------------------------------------------------- 1 | Command update 2 | ============== 3 | 4 | Help information: `gopm update -h` or `gopm help update`: 5 | 6 | ``` 7 | NAME: 8 | update - check and update gopm resources including itself 9 | 10 | USAGE: 11 | command update [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command update checks updates of resources and gopm itself. 15 | 16 | gopm update 17 | 18 | Resources will be updated automatically after executed this command, 19 | but you have to confirm before updaing gopm itself. 20 | 21 | OPTIONS: 22 | --verbose, -v show process details 23 | ``` 24 | 25 | ### `gopm update` 26 | 27 | - Feature: Check and update gopm resources including itself. 28 | - Detail: Check resources' version and download the latest ones. 29 | - Example: `gopm update`. 30 | 31 | ## Options 32 | 33 | - `-verbose`: show process details. -------------------------------------------------------------------------------- /en-US/clean.md: -------------------------------------------------------------------------------- 1 | Command clean 2 | ============= 3 | 4 | Help information: `gopm clean -h` or `gopm help clean`: 5 | 6 | ``` 7 | NAME: 8 | clean - clean all temporary files 9 | 10 | USAGE: 11 | command clean [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command clean deletes all temporary files generated by gopm 15 | 16 | gopm clean 17 | 18 | OPTIONS: 19 | --verbose, -v show process details 20 | ``` 21 | 22 | ### `gopm clean` 23 | 24 | - Feature: Delete temporary files that are generated by gopm. 25 | - Example: `gopm clean`. 26 | 27 | ## Options 28 | 29 | - `--verbose, -v`: show process details. -------------------------------------------------------------------------------- /en-US/gopmfile.md: -------------------------------------------------------------------------------- 1 | gopmfile 2 | ======== 3 | 4 | The gopmfile need to be put under root path of project, and named `.gopmfile`. 5 | 6 | A sample gopmfile: 7 | 8 | [target] 9 | path = github.com/gpmgo/gopm 10 | 11 | [deps] 12 | github.com/codegangsta/cli = branch:master 13 | 14 | [res] 15 | include = conf|etc|public|scripts|templates 16 | 17 | - `target -> path` indicates the project name or import path. 18 | - `deps` section contains special(non-latest) versions dependencies. 19 | - `res` resources that will be auto-packed with `gopm bin` command. 20 | 21 | ## How to write package version 22 | 23 | There are 5 possible patterns for package version: 24 | 25 | - Blank: which means always build with latest version of dependency. 26 | - `/path/to/my/project`:directory path, for example: `d:\projects\xorm`. 27 | - `branch:`: certain branch, for example: `branch:master`. 28 | - `tag:`: specified tag, for example: `tag:v0.9.0`. 29 | - `commit:`: fixed commit, for example: `commit:6ffffe9`. Usually only first 7 letters of SHA is enough to determine a commit. 30 | -------------------------------------------------------------------------------- /en-US/list.md: -------------------------------------------------------------------------------- 1 | Command list 2 | ============ 3 | 4 | Help information: `gopm list -h` or `gopm help list`: 5 | 6 | ``` 7 | NAME: 8 | list - list all dependencies of current project 9 | 10 | USAGE: 11 | command list [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command list lsit all dependencies of current Go project 15 | 16 | gopm list 17 | 18 | Make sure you run this command in the root path of a go project. 19 | 20 | OPTIONS: 21 | --tags apply build tags 22 | --test, -t show test imports 23 | --verbose, -v show process details 24 | ``` 25 | 26 | ### `gopm list` 27 | 28 | - Feature: List all dependencies of current project and shows its reversion if available in gopmfile. 29 | - Example: `gopm list` 30 | 31 | #### Usage example 32 | 33 | Following content shows an example of `gopm list -v`: 34 | 35 | ``` 36 | [GOPM] 14-09-22 20:48:08 [ INFO] Local repository path: /Users/jiahuachen/.gopm/repos 37 | [GOPM] 14-09-22 20:48:08 [ INFO] Indicated GOPATH: /Users/jiahuachen/Applications/Go 38 | Dependency list(20): 39 | -> github.com/Unknwon/cae @ commit:2e70a1351b 40 | -> github.com/Unknwon/com @ commit:2cbcbc6916 41 | -> github.com/Unknwon/goconfig @ commit:0f8d8dc1c0 42 | -> github.com/Unknwon/i18n @ commit:47baeff8d0 43 | -> github.com/Unknwon/macaron 44 | -> github.com/codegangsta/cli @ commit:7381bc4e62 45 | -> github.com/go-sql-driver/mysql @ commit:8111ee3ec3 46 | -> github.com/go-xorm/core @ commit:750aae0fa5 47 | -> github.com/go-xorm/xorm @ commit:2d8b3135b1 48 | -> github.com/gogits/gfm @ commit:40f747a9c0 49 | -> github.com/gogits/oauth2 @ commit:99cbec870a 50 | -> github.com/lib/pq @ commit:b021d0ef20 51 | -> github.com/macaron-contrib/cache @ commit:204d8e5137 52 | -> github.com/macaron-contrib/captcha 53 | -> github.com/macaron-contrib/csrf 54 | -> github.com/macaron-contrib/i18n 55 | -> github.com/macaron-contrib/session 56 | -> github.com/macaron-contrib/toolbox @ commit:57127bcc89 57 | -> github.com/nfnt/resize @ commit:581d15cb53 58 | -> github.com/saintfish/chardet @ commit:3af4cd4741 59 | ``` 60 | 61 | ## Options 62 | 63 | - `--tags`: apply build tags. 64 | - `--test, -t`: list dependencies of test files. 65 | - `--verbose, -v`: show process details. -------------------------------------------------------------------------------- /en-US/test.md: -------------------------------------------------------------------------------- 1 | Command test 2 | ============ 3 | 4 | Help information: `gopm test -h` or `gopm help test`: 5 | 6 | ``` 7 | NAME: 8 | test - link dependencies and go test 9 | 10 | USAGE: 11 | command test [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command test links dependencies according to gopmfile, 15 | and execute 'go test' 16 | 17 | gopm test 18 | 19 | OPTIONS: 20 | --tags apply build tags 21 | --verbose, -v show process details 22 | ``` 23 | 24 | ### `gopm test ` 25 | 26 | - Feature: Link dependencies according to gopmfile and go test. 27 | - Example: `gopm test`. 28 | 29 | ## Options 30 | 31 | - `--tags`: apply build tags. 32 | - `--verbose, -v`: show process details. -------------------------------------------------------------------------------- /images/arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpmgo/docs/730ebc1cf5244afa08655e7eba0e10d0202ab5c7/images/arch.png -------------------------------------------------------------------------------- /pkgname.list: -------------------------------------------------------------------------------- 1 | gogs=github.com/gogits/gogs 2 | macaron=github.com/Unknwon/macaron 3 | beego=github.com/astaxie/beego 4 | xorm=github.com/go-xorm/xorm 5 | beeweb=github.com/beego/beeweb 6 | qbs=github.com/coocood/qbs 7 | jas=github.com/coocood/jas 8 | com=github.com/Unknwon/com 9 | gowalker=github.com/Unknwon/gowalker 10 | gopm=github.com/gpmgo/gopm 11 | goconfig=github.com/Unknwon/goconfig 12 | bee=github.com/beego/bee 13 | revel=github.com/revel/revel 14 | martini=github.com/codegangsta/martini 15 | goconvey=github.com/smartystreets/goconvey 16 | qml=github.com/niemeyer/qml 17 | goquery=github.com/PuerkitoBio/goquery 18 | xweb=github.com/lunny/xweb 19 | fsnotify=github.com/go-fsnotify/fsnotify 20 | go.net=code.google.com/p/go.net 21 | go.tools=code.google.com/p/go.tools 22 | blackfriday=github.com/russross/blackfriday 23 | resize=github.com/nfnt/resize -------------------------------------------------------------------------------- /zh-CN/Bin.md: -------------------------------------------------------------------------------- 1 | bin 命令 2 | ======= 3 | 4 | 帮助信息:`gopm bin -h` 或 `gopm bin get`: 5 | 6 | ``` 7 | NAME: 8 | bin - download and link dependencies and build binary 9 | 10 | USAGE: 11 | command bin [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command bin downloads and links dependencies according to gopmfile, 15 | and build executable binary to work directory 16 | 17 | gopm bin @[:] 18 | gopm bin @[:] 19 | 20 | Can only specify one each time, and only works for projects that 21 | contain main package 22 | 23 | OPTIONS: 24 | --tags apply build tags 25 | --dir, -d './' build binary to given directory 26 | --update, -u update pakcage(s) and dependencies if any 27 | --remote, -r build with pakcages in gopm local repository only 28 | --verbose, -v show process details 29 | ``` 30 | 31 | ### `gopm bin @[:]` 32 | 33 | - 功能:下载指定版本的远程包及其依赖并构建可执行文件。 34 | - 说明:无需手动处理源代码即可快速构建二进制文件。 35 | - 示例: 36 | - 最新版本:`gopm bin github.com/gpmgo/gopm`. 37 | - 固定分支(branch):`gopm bin github.com/gpmgo/gopm@branch:master`。 38 | - 指定标签(tag):`gopm bin github.com/gpmgo/gopm@tag:tag:v0.1.0`。 39 | - 某个提交(commit):`gopm bin github.com/gpmgo/gopm@commit:23ce93a`。 40 | 41 | #### 使用示例 42 | 43 | 如果您想要将二进制构建至指定路径,则可以使用 `--dir, -d` 选项来达到目的。例如,我想将 gopm 构建至 `$GOROOT/bin`,则我应该执行 `gopm bin -d $GOROOT/bin github.com/gpmgo/gopm`。 44 | 45 | ##### 最新版本:`gopm bin github.com/gpmgo/gopm` 46 | 47 | 该命令下载最新版本的 gopm,并将二进制构建至当前目录。 48 | 49 | ##### 固定分支:`gopm bin github.com/gpmgo/gopm@branch:master` 50 | 51 | 该命令下载 gopm 的 master 分支的最新版,并将二进制构建至当前目录。 52 | 53 | ##### 指定标签:`gopm bin github.com/gpmgo/gopm@tag:tag:v0.1.0` 54 | 55 | 该命令下载 `tag:v0.1.0` 版本的 gopm,并将二进制构建至当前目录。 56 | 57 | ##### 某个提交:`gopm bin github.com/gpmgo/gopm@commit:23ce93a` 58 | 59 | 该命令下载提交 `commit:23ce93a` 时刻的 gopm,并将二进制构建至当前目录。 60 | 61 | ### `gopm bin @[:]` 62 | 63 | - 功能:下载指定版本的远程包及其依赖并构建可执行文件;但可使用项目名称代替完整的导入路径。 64 | - 说明:该命令为包导入路径的快捷版。 65 | - 示例: 66 | - 最新版本:`gopm bin gopm`。 67 | - 固定分支(branch):`gopm bin gopm@branch:master`。 68 | - 指定标签(tag):`gopm bin gopm@tag:v0.1.0`。 69 | - 某个提交(commit):`gopm bin gopm@commit:23ce93a`。 70 | 71 | 查看 [知名 Go 项目列表](../pkgname.list) 获取更多信息。 72 | 73 | ## 选项 74 | 75 | - `--tags`:应用构建 tags。 76 | - `-dir, -d`:构建可执行文件到指定目录。 77 | - `--update, -u`:检查更新所有包。 78 | - `--verbose, -v`:显示详细信息。 -------------------------------------------------------------------------------- /zh-CN/Build.md: -------------------------------------------------------------------------------- 1 | build 命令 2 | ========= 3 | 4 | 帮助信息:`gopm build -h` 或 `gopm help build`: 5 | 6 | ``` 7 | NAME: 8 | build - link dependencies and go build 9 | 10 | USAGE: 11 | command build [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command build links dependencies according to gopmfile, 15 | and execute 'go build' 16 | 17 | gopm build 18 | 19 | OPTIONS: 20 | --tags apply build tags 21 | --update, -u update pakcage(s) and dependencies if any 22 | --remote, -r build with pakcages in gopm local repository only 23 | --verbose, -v show process details 24 | ``` 25 | 26 | ### `gopm build ` 27 | 28 | - 功能:根据 gopmfile 链接依赖并执行 go build。 29 | - 说明:下载丢失的依赖并链接,然后构建二进制。 30 | - 示例:`gopm build`。 31 | 32 | ## 选项 33 | 34 | - `--tags`:应用构建 tags。 35 | - `--update, -u`:在构建之前检查包和依赖更新。 36 | - `--verbose, -v`:显示详细信息。 -------------------------------------------------------------------------------- /zh-CN/Gen.md: -------------------------------------------------------------------------------- 1 | gen 命令 2 | ======= 3 | 4 | Help information: `gopm gen -h` or `gopm help gen`: 5 | 6 | ``` 7 | NAME: 8 | gen - generate a gopmfile for current Go project 9 | 10 | USAGE: 11 | command gen [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command gen gets dependencies and generates a gopmfile 15 | 16 | gopm gen 17 | 18 | Make sure you run this command in the root path of a go project. 19 | 20 | OPTIONS: 21 | --tags apply build tags 22 | --local, -l generate local GOPATH directories 23 | --verbose, -v show process details 24 | ``` 25 | 26 | ### `gopm gen` 27 | 28 | - 功能:根据当前 Go 项目生成 gopmfile。 29 | - 说明:获取依赖并写入 gopmfile。 30 | - 示例:`gopm gen`。 31 | 32 | #### 使用用例 33 | 34 | 我现在正在目录 `$GOPATH/src/github.com/gogits/gogs` 下,此时我需要生成一个 gopmfile: 35 | 36 | $ gopm gen 37 | $ cat .gopmfile 38 | 39 | 输出: 40 | 41 | ``` 42 | [target] 43 | path = github.com/gogits/gogs 44 | 45 | [deps] 46 | github.com/beego/memcache = commit:2aea774416 47 | github.com/beego/redigo = commit:856744a0d5 48 | github.com/Unknwon/cae = commit:2e70a1351b 49 | github.com/Unknwon/com = commit:2cbcbc6916 50 | github.com/Unknwon/goconfig = commit:0f8d8dc1c0 51 | github.com/Unknwon/i18n = commit:47baeff8d0 52 | github.com/Unknwon/macaron = 53 | github.com/codegangsta/cli = commit:7381bc4e62 54 | github.com/go-sql-driver/mysql = commit:8111ee3ec3 55 | github.com/go-xorm/core = commit:750aae0fa5 56 | github.com/go-xorm/xorm = commit:2d8b3135b1 57 | github.com/gogits/gfm = commit:40f747a9c0 58 | github.com/gogits/oauth2 = commit:99cbec870a 59 | github.com/lib/pq = commit:b021d0ef20 60 | github.com/macaron-contrib/cache = commit:204d8e5137 61 | github.com/macaron-contrib/captcha = 62 | github.com/macaron-contrib/csrf = 63 | github.com/macaron-contrib/i18n = 64 | github.com/macaron-contrib/session = 65 | github.com/macaron-contrib/toolbox = commit:57127bcc89 66 | github.com/mattn/go-sqlite3 = commit:a80c27ba33 67 | github.com/nfnt/resize = commit:581d15cb53 68 | github.com/saintfish/chardet = commit:3af4cd4741 69 | 70 | [res] 71 | include = conf|etc|public|scripts|templates 72 | ``` 73 | 74 | 有关如何书写包版本的信息,请阅读 [gopmfile](gopmfile.md)。 75 | 76 | 77 | ## 选项 78 | 79 | - `--tags`:在列举依赖时应用构建 tags。 80 | - `--verbose, -v`:显示详细信息。 81 | -------------------------------------------------------------------------------- /zh-CN/Get.md: -------------------------------------------------------------------------------- 1 | get 命令 2 | ======= 3 | 4 | 帮助信息:`gopm get -h` 或 `gopm help get`: 5 | 6 | ``` 7 | NAME: 8 | get - fetch remote package(s) and dependencies 9 | 10 | USAGE: 11 | command get [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command get fetches a package or packages, 15 | and any pakcage that it or they depend(s) on. 16 | If the package has a gopmfile, the fetch process will be driven by that. 17 | 18 | gopm get 19 | gopm get @[:] 20 | gopm get @[:] 21 | 22 | Can specify one or more: gopm get cli@tag:v1.2.0 github.com/Unknwon/macaron 23 | 24 | If no version specified and package exists in GOPATH, 25 | it will be skipped, unless user enabled '--remote, -r' option 26 | then all the packages go into gopm local repository. 27 | 28 | OPTIONS: 29 | --tags apply build tags 30 | --download, -d download given package only 31 | --update, -u update package(s) and dependencies if any 32 | --local, -l download all packages to local GOPATH 33 | --gopath, -g download all pakcages to GOPATH 34 | --remote, -r download all pakcages to gopm local repository 35 | --verbose, -v show process details 36 | ``` 37 | 38 | ### `gopm get` 39 | 40 | - 功能:根据 gopmfile 拉取远程包及其依赖到本地仓库。 41 | - 说明:如果未传入任何参数,则 gopm 根据在当前目录的项目来进行依赖包的拉取。如果发现 gopmfile 文件,则会应用相关规则。 42 | - 示例:`gopm get`。 43 | 44 | #### 使用示例 45 | 46 | ##### `gopm get` 47 | 48 | 假设您的当前目录是 gopm(`github.com/gpmgo/gopm`)项目的根目录: 49 | 50 | $ pwd 51 | 52 | 输出: 53 | 54 | $GOPATH/src/github.com/gpmgo/gopm 55 | 56 | 然后在目录下有一个 gopmfile 文件: 57 | 58 | $ cat .gopmfile 59 | 60 | 输出: 61 | 62 | ``` 63 | [target] 64 | path = github.com/gpmgo/gopm 65 | 66 | [deps] 67 | github.com/Unknwon/com = 68 | github.com/Unknwon/goconfig = 69 | github.com/aybabtme/color = 70 | github.com/codegangsta/cli = 71 | github.com/Unknwon/cae = 72 | ``` 73 | 74 | 如果节 `deps` 中的 4 个包不存在于你的 `$GOPATH` 中,则该命令会下载它们(到 gopm 本地仓库 `~/.gopm/repos`)。 75 | 76 | 假设您需要将他们全部下载到 `$GOPATH` 中,然后做一些修改重新编译 gopm。则您可以使用选项 `--gopath, -g` 来达到目的。 77 | 78 | 然而,当您希望保持您的 `$GOPATH` 整洁,而将它们全部下载到 gopm 本地仓库。则您可以使用选项 `--remote, -r` 来达到目的。 79 | 80 | 81 | ### `gopm get @[:]` 82 | 83 | - 功能:拉取指定版本的远程包及其依赖到本地仓库。 84 | - 说明:该命令可接受一个或多个参数附带或不带指定版本。 85 | - 示例: 86 | - 最新版本:`gopm get github.com/go-xorm/xorm`. 87 | - 固定分支(branch):`gopm get github.com/go-xorm/xorm@branch:master`。 88 | - 指定标签(tag):`gopm get github.com/go-xorm/xorm@tag:v0.2.3`。 89 | - 某个提交(commit):`gopm get github.com/go-xorm/xorm@commit:6ffffe9`。 90 | 91 | #### 使用用例 92 | 93 | ##### 最新版本:`gopm get github.com/go-xorm/xorm` 94 | 95 | 该命令下载最新版本的 xorm,并根据 gopmfile 下载它的依赖包。 96 | 97 | ##### 固定分支:`gopm get github.com/go-xorm/xorm@branch:master` 98 | 99 | 该命令下载 xorm 的 master 分支的最新版,并根据 gopmfile 下载它的依赖包。 100 | 101 | ##### 指定标签:`gopm get github.com/go-xorm/xorm@tag:v0.2.3` 102 | 103 | 该命令下载 `tag:v0.2.3` 版本的 xorm,并根据 gopmfile 下载它的依赖包。 104 | 105 | ##### 某个提交:`gopm get github.com/go-xorm/xorm@commit:6ffffe9` 106 | 107 | 该命令下载提交 `commit:6ffffe9` 时刻的 xorm,并根据 gopmfile 下载它的依赖包。 108 | 109 | ### `gopm get @[:]` 110 | 111 | - 功能:拉取指定版本的远程包及其依赖到本地仓库;但可使用项目名称代替完整的导入路径。 112 | - 说明:该命令为包导入路径的快捷版。 113 | - 示例: 114 | - 最新版本:`gopm get xorm`。 115 | - 固定分支(branch):`gopm get xorm@branch:master`。 116 | - 指定标签(tag):`gopm get xorm@tag:v0.2.3`。 117 | - 某个提交(commit):`gopm get xorm@commit:6ffffe9`。 118 | 119 | 查看 [知名 Go 项目列表](../pkgname.list) 获取更多信息。 120 | 121 | ## 选项 122 | 123 | - `--tags`:应用构建 tags。 124 | - `--download, -d`:仅下载当前指定的包。 125 | - `--update, -u`:检查更新所有包。 126 | - `--gopath, -g `:下载所有包至 GOPATH 中。 127 | - `--remote, -r`:将所有包下载至 gopm 本地仓库。 128 | - `--verbose, -v`:显示详细信息。 129 | -------------------------------------------------------------------------------- /zh-CN/Install.md: -------------------------------------------------------------------------------- 1 | install 命令 2 | =========== 3 | 4 | 帮助信息:`gopm install -h` 或 `gopm help install`: 5 | 6 | ``` 7 | NAME: 8 | install - link dependencies and go install 9 | 10 | USAGE: 11 | command install [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command install links dependencies according to gopmfile, 15 | and execute 'go install' 16 | 17 | gopm install 18 | 19 | If no argument is supplied, then gopmfile must be present 20 | 21 | OPTIONS: 22 | --tags apply build tags 23 | --remote, -r build with pakcages in gopm local repository only 24 | --verbose, -v show process details 25 | ``` 26 | 27 | ### `gopm install` 28 | 29 | - 功能:根据当前项目 gopmfile 链接依赖并执行 go install。 30 | - 说明:下载丢失的依赖然后链接并安装它们。 31 | - 示例:`gopm install`。 32 | 33 | ### `gopm install ` 34 | 35 | - 功能:根据指定导入路径 gopmfile 链接依赖并执行 go install。 36 | - 说明:下载丢失的依赖然后链接并安装它们。 37 | - 示例:`gopm install github.com/Unknwon/com`。 38 | 39 | ## 选项 40 | 41 | - `--tags`:应用构建 tags。 42 | - `--verbose, -v`:显示详细信息。 -------------------------------------------------------------------------------- /zh-CN/Quickstart.md: -------------------------------------------------------------------------------- 1 | 快速入门 2 | ======= 3 | 4 | 在本小节中,我们将会演示一个安装两种不同版本的 beego 并打印版本信息的简单示例。 5 | 6 | ## 准备工作 7 | 8 | 您不需要将这个项目置于任何 `$GOPATH` 下,所以我们就将它放在 `~/demo` 中: 9 | 10 | $ mkdir ~/demo 11 | $ cd ~/demo 12 | 13 | 然后,创建 `main.go` 文件: 14 | 15 | $ touch main.go 16 | 17 | 复制以下代码并粘贴到文件中: 18 | 19 | ```go 20 | package main 21 | 22 | import ( 23 | "github.com/astaxie/beego" 24 | ) 25 | 26 | func main() { 27 | println("Beego version:", beego.VERSION) 28 | } 29 | ``` 30 | 31 | 很好! 32 | 33 | ## gopmfile 34 | 35 | 这个文件包含 gopm 所需要的所有信息,我们现在就来看看可以在这个示例中对它做什么。 36 | 37 | 首先,您需要在项目目录中创建 `.gopmfile` 文件: 38 | 39 | $ touch .gopmfile 40 | 41 | 不错,接着把以下内容复制到文件中: 42 | 43 | [target] 44 | path = demo 45 | 46 | 键 `path` 指示了您的项目名称。 47 | 48 | **注意事项** 如果您的导入路径类似 `github.com/gpmgo/gopm` 则应该使用 `path = github.com/gpmgo/gopm` 而不是 `path = gopm`。 49 | 50 | ## 构建项目 51 | 52 | ### 默认配置 53 | 54 | 现在让我们先基于默认设定来构建这个项目,也就是全部使用最新版本的依赖包。 55 | 56 | $ gopm build 57 | 58 | 当命令执行成功时,不会输出任何内容。但如果您想要查看详细信息,则可以通过选项 `-v` 实现: 59 | 60 | $ gopm build -v 61 | 62 | 下面是一个输出样例: 63 | 64 | ``` 65 | [GOPM] 14-09-17 17:40:11 [ INFO] Local repository path: /Users/jiahuachen/.gopm/repos 66 | [GOPM] 14-09-17 17:40:11 [ INFO] Indicated GOPATH: /Users/jiahuachen/Applications/Go 67 | [GOPM] 14-09-17 17:40:11 [DEBUG] Linking demo... 68 | [GOPM] 14-09-17 17:40:11 [DEBUG] Loading dependencies... 69 | [GOPM] 14-09-17 17:40:11 [ INFO] Building... 70 | [GOPM] 14-09-17 17:40:11 [ INFO] Setting GOPATH to /Users/jiahuachen/demo/.vendor 71 | [GOPM] 14-09-17 17:40:11 [ INFO] ===== application outputs start ===== 72 | 73 | [GOPM] 14-09-17 17:40:11 [ INFO] ====== application outputs end ====== 74 | [GOPM] 14-09-17 17:40:11 [ INFO] Setting GOPATH back to /Users/jiahuachen/Applications/Go 75 | [GOPM] 14-09-17 17:40:11 [ INFO] Command executed successfully! 76 | ``` 77 | 78 | 正如您所看到的,由于我的 `$GOPATH` 中已经下载了最新版本的 beego 及其依赖包,而且我没有指定任何特殊版本,因此 gopm 不会对它们进行链接操作。 79 | 80 | 现在执行以下指令: 81 | 82 | $ ./demo 83 | 84 | 您应该看到类似下面的输出: 85 | 86 | beego version: 1.4.0 87 | 88 | ### 自定义配置 89 | 90 | 假如说由于 beego 的 API 破坏,我们需要基于 `v0.9.0` 版本的 beego 构建我们的项目,所以我们需要将 gopmfile 修改为以下内容: 91 | 92 | [target] 93 | path = demo 94 | 95 | [deps] 96 | github.com/astaxie/beego = tag:v0.9.0 97 | 98 | 在节 `deps` 中我们指示我们需要的 beego 版本为 `tag:v0.9.0`。 99 | 100 | 下载依赖并重新构建我们的项目,然后运行: 101 | 102 | $ gopm get 103 | $ gopm build 104 | $ ./demo 105 | 106 | 同样的,您可以用过 `-v` 选项来查看详细信息: 107 | 108 | ``` 109 | [GOPM] 14-09-17 18:07:28 [ INFO] Local repository path: /Users/jiahuachen/.gopm/repos 110 | [GOPM] 14-09-17 18:07:28 [ INFO] Indicated GOPATH: /Users/jiahuachen/Applications/Go 111 | [GOPM] 14-09-17 18:07:28 [DEBUG] Linking demo... 112 | [GOPM] 14-09-17 18:07:28 [DEBUG] Loading dependencies... 113 | [GOPM] 14-09-17 18:07:28 [DEBUG] Linking github.com/astaxie/beego.v0.9.0... 114 | [GOPM] 14-09-17 18:07:28 [DEBUG] Linking github.com/garyburd/redigo... 115 | [GOPM] 14-09-17 18:07:28 [ WARN] Getting imports: no buildable Go source files in /Users/jiahuachen/demo/.vendor/src/github.com/garyburd/redigo 116 | [GOPM] 14-09-17 18:07:28 [ INFO] Building... 117 | [GOPM] 14-09-17 18:07:28 [ INFO] Setting GOPATH to /Users/jiahuachen/demo/.vendor 118 | [GOPM] 14-09-17 18:07:28 [ INFO] ===== application outputs start ===== 119 | 120 | [GOPM] 14-09-17 18:07:29 [ INFO] ====== application outputs end ====== 121 | [GOPM] 14-09-17 18:07:29 [ INFO] Setting GOPATH back to /Users/jiahuachen/Applications/Go 122 | [GOPM] 14-09-17 18:07:29 [ INFO] Command executed successfully! 123 | ``` 124 | 125 | 值得注意的是,gopm 为此下载了 3 个包(到 gopm 本地仓库),分别是 `github.com/astaxie/beego` 和 `github.com/garyburd/redigo` 这几个我并没有安装在我的电脑上,以及忽略了我已经安装(在 `$GOPATH`)的包 `code.google.com/p/vitess/go/memcache`。 126 | 127 | 这个例子充分说明了 gopm 能够很好地与 `$GOPATH` 共同协作。 128 | 129 | 现在,输出应该变成以下内容: 130 | 131 | Beego version: 0.9.0 132 | 133 | 很好很强大,你说是不是! 134 | -------------------------------------------------------------------------------- /zh-CN/README.md: -------------------------------------------------------------------------------- 1 | 文档索引 2 | ======= 3 | 4 | - [快速入门](Quickstart.md) 5 | - [list 命令](list.md) 6 | - [gen 命令](Gen.md) 7 | - [get 命令](Get.md) 8 | - [bin 命令](Bin.md) 9 | - [run 命令](Run.md) 10 | - [test 命令](test.md) 11 | - [build 命令](Build.md) 12 | - [install 命令](Install.md) 13 | - [clean 命令](clean.md) 14 | - [update 命令](Update.md) 15 | - [gopmfile](gopmfile.md) -------------------------------------------------------------------------------- /zh-CN/Run.md: -------------------------------------------------------------------------------- 1 | run 命令 2 | ==== 3 | 4 | 帮助信息:`gopm run -h` 或 `gopm help run`: 5 | 6 | ``` 7 | NAME: 8 | run - link dependencies and go run 9 | 10 | USAGE: 11 | command run [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command run links dependencies according to gopmfile, 15 | and execute 'go run' 16 | 17 | gopm run 18 | gopm run -l will recursively find .gopmfile with value localPath 19 | and run the cmd in the .gopmfile, Windows hasn't supported yet, 20 | you need to run the command right at the local_gopath dir. 21 | 22 | OPTIONS: 23 | --tags apply build tags 24 | --local, -l run command with local gopath context 25 | --verbose, -v show process details 26 | ``` 27 | 28 | ### `gopm run ` 29 | 30 | - 功能:根据 gopmfile 链接依赖并执行 go run。 31 | - 示例:`gopm run main.go`。 32 | 33 | ## 选项 34 | 35 | - `--tags`:应用构建 tags。 36 | - `--verbose, -v`:显示详细信息。 -------------------------------------------------------------------------------- /zh-CN/Update.md: -------------------------------------------------------------------------------- 1 | update 命令 2 | ========== 3 | 4 | 帮助信息:`gopm update -h` 或 `gopm help update`: 5 | 6 | ``` 7 | NAME: 8 | update - check and update gopm resources including itself 9 | 10 | USAGE: 11 | command update [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command update checks updates of resources and gopm itself. 15 | 16 | gopm update 17 | 18 | Resources will be updated automatically after executed this command, 19 | but you have to confirm before updaing gopm itself. 20 | 21 | OPTIONS: 22 | --verbose, -v show process details 23 | ``` 24 | 25 | ### `gopm update` 26 | 27 | - 功能:检查更新最新的 gopm 资源,包括 gopm 自身。 28 | - 说明:检查资源的版本并下载最新版本。 29 | - 示例:`gopm update`: 30 | 31 | ## 选项 32 | 33 | - `--verbose, -v`:显示详细信息。 -------------------------------------------------------------------------------- /zh-CN/clean.md: -------------------------------------------------------------------------------- 1 | clean 命令 2 | ========= 3 | 4 | 帮助信息:`gopm clean -h` 或 `gopm clean run`: 5 | 6 | ``` 7 | NAME: 8 | clean - clean all temporary files 9 | 10 | USAGE: 11 | command clean [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command clean deletes all temporary files generated by gopm 15 | 16 | gopm clean 17 | 18 | OPTIONS: 19 | --verbose, -v show process details 20 | ``` 21 | 22 | ### `gopm clean` 23 | 24 | - 功能:清除由 gopm 产生的临时文件。 25 | - 示例:`gopm clean`。 26 | 27 | ## 选项 28 | 29 | - `--verbose, -v`:显示详细信息。 -------------------------------------------------------------------------------- /zh-CN/gopmfile.md: -------------------------------------------------------------------------------- 1 | gopmfile 2 | ======== 3 | 4 | gopmfile 需放在项目根目录下,名称为 `.gopmfile`。 5 | 6 | 样例 gopmfile 文件: 7 | 8 | [target] 9 | path = github.com/gpmgo/gopm 10 | 11 | [deps] 12 | github.com/codegangsta/cli = branch:master 13 | 14 | [res] 15 | include = conf|etc|public|scripts|templates 16 | 17 | - `target -> path` 指示项目名称或导入路径。 18 | - `deps` 节包含了特殊(非最新)版本的依赖。 19 | - `res` 在执行 `gopm bin` 命令时自动打包的资源。 20 | 21 | ## 如何编写包版本 22 | 23 | 有五种可能的包版本组合: 24 | 25 | - 空白:表示使用最新版本的依赖进行构建。 26 | - `/path/to/my/project`:绝对或者相对的文件路径,例如:`d:\projects\xorm`。 27 | - `branch:`:固定分支,例如:`branch:master`。 28 | - `tag:`:指定标签,例如:`tag:v0.9.0`。 29 | - `commit:`:某个提交,例如:`commit:6ffffe9`。一般来说只需要 SHA 的前 7 个字母就可以确定一个提交。 -------------------------------------------------------------------------------- /zh-CN/list.md: -------------------------------------------------------------------------------- 1 | list 命令 2 | ======== 3 | 4 | 帮助信息:`gopm list -h` or `gopm help list`: 5 | 6 | ``` 7 | NAME: 8 | list - list all dependencies of current project 9 | 10 | USAGE: 11 | command list [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command list lsit all dependencies of current Go project 15 | 16 | gopm list 17 | 18 | Make sure you run this command in the root path of a go project. 19 | 20 | OPTIONS: 21 | --tags apply build tags 22 | --test, -t show test imports 23 | --verbose, -v show process details 24 | ``` 25 | 26 | ### `gopm list` 27 | 28 | - 功能:根据当前项目并结合 gopmfile 列出所有依赖和相应的版本。 29 | - 示例:`gopm list` 30 | 31 | #### 使用示例 32 | 33 | 下面为 `gopm list -v` 命令的示例输出: 34 | 35 | ``` 36 | [GOPM] 14-09-22 20:48:08 [ INFO] Local repository path: /Users/jiahuachen/.gopm/repos 37 | [GOPM] 14-09-22 20:48:08 [ INFO] Indicated GOPATH: /Users/jiahuachen/Applications/Go 38 | Dependency list(20): 39 | -> github.com/Unknwon/cae @ commit:2e70a1351b 40 | -> github.com/Unknwon/com @ commit:2cbcbc6916 41 | -> github.com/Unknwon/goconfig @ commit:0f8d8dc1c0 42 | -> github.com/Unknwon/i18n @ commit:47baeff8d0 43 | -> github.com/Unknwon/macaron 44 | -> github.com/codegangsta/cli @ commit:7381bc4e62 45 | -> github.com/go-sql-driver/mysql @ commit:8111ee3ec3 46 | -> github.com/go-xorm/core @ commit:750aae0fa5 47 | -> github.com/go-xorm/xorm @ commit:2d8b3135b1 48 | -> github.com/gogits/gfm @ commit:40f747a9c0 49 | -> github.com/gogits/oauth2 @ commit:99cbec870a 50 | -> github.com/lib/pq @ commit:b021d0ef20 51 | -> github.com/macaron-contrib/cache @ commit:204d8e5137 52 | -> github.com/macaron-contrib/captcha 53 | -> github.com/macaron-contrib/csrf 54 | -> github.com/macaron-contrib/i18n 55 | -> github.com/macaron-contrib/session 56 | -> github.com/macaron-contrib/toolbox @ commit:57127bcc89 57 | -> github.com/nfnt/resize @ commit:581d15cb53 58 | -> github.com/saintfish/chardet @ commit:3af4cd4741 59 | ``` 60 | 61 | ## 选项 62 | 63 | - `--tags`:应用构建 tags。 64 | - `--test, -t`:列举出 test 文件的依赖。 65 | - `--verbose, -v`:显示详细信息。 -------------------------------------------------------------------------------- /zh-CN/test.md: -------------------------------------------------------------------------------- 1 | test 命令 2 | ======== 3 | 4 | 帮助信息:`gopm test -h` 或 `gopm test run`: 5 | 6 | ``` 7 | NAME: 8 | test - link dependencies and go test 9 | 10 | USAGE: 11 | command test [command options] [arguments...] 12 | 13 | DESCRIPTION: 14 | Command test links dependencies according to gopmfile, 15 | and execute 'go test' 16 | 17 | gopm test 18 | 19 | OPTIONS: 20 | --tags apply build tags 21 | --verbose, -v show process details 22 | ``` 23 | 24 | ### `gopm test ` 25 | 26 | - 功能:根据 gopmfile 链接依赖并执行 go test。 27 | - 示例:`gopm test`。 28 | 29 | ## 选项 30 | 31 | - `--tags`:应用构建 tags。 32 | - `--verbose, -v`:显示详细信息。 --------------------------------------------------------------------------------