diff options
author | 2015-11-03 08:30:17 +0000 | |
---|---|---|
committer | 2015-11-03 18:04:23 +0000 | |
commit | 8c4fbe902fe75067f77f3ecf1ba8e2744e22e660 (patch) | |
tree | 3bfb56a931533bc8b3b58496c45ccdbc021e6da3 /tools/build_rules/go/README.md | |
parent | 3b987d2393d75a27c227cc0511e1ae8f9b0f139b (diff) |
[go] Add attribute documentation.
--
MOS_MIGRATED_REVID=106918682
Diffstat (limited to 'tools/build_rules/go/README.md')
-rw-r--r-- | tools/build_rules/go/README.md | 198 |
1 files changed, 197 insertions, 1 deletions
diff --git a/tools/build_rules/go/README.md b/tools/build_rules/go/README.md index aa858ff14d..3db331c06b 100644 --- a/tools/build_rules/go/README.md +++ b/tools/build_rules/go/README.md @@ -1,5 +1,17 @@ # Go rules +<div class="toc"> + <h2>Rules</h2> + <ul> + <li><a href="#go_prefix">go_prefix</a></li> + <li><a href="#go_library">go_library</a></li> + <li><a href="#go_binary">go_binary</a></li> + <li><a href="#go_test">go_test</a></li> + </ul> +</div> + +## Overview + The rules should be considered experimental. They support: * libraries @@ -10,7 +22,7 @@ The rules should be considered experimental. They support: They currently do not support (in order of importance): * Darwin -* //+build tags +* `//+build` tags * auto generated BUILD files. * C/C++ interoperation (cgo, swig etc.) * race detector @@ -86,3 +98,187 @@ and it should work. ## Disclaimer These rules are not supported by Google's Go team. + +<a name="go_prefix"></a> +## go\_prefix + +```python +go_prefix(prefix) +``` + +<table class="table table-condensed table-bordered table-params"> + <colgroup> + <col class="col-param" /> + <col class="param-description" /> + </colgroup> + <thead> + <tr> + <th colspan="2">Attributes</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>prefix</code></td> + <td> + <code>String, required</code> + <p>Global prefix used to fully quality all Go targets.</p> + <p> + In Go, imports are always fully qualified with a URL, eg. + <code>github.com/user/project</code>. Hence, a label <code>//foo:bar + </code> from within a Bazel workspace must be referred to as + <code>github.com/user/project/foo/bar</code>. To make this work, each + rule must know the repository's URL. This is achieved, by having all + go rules depend on a globally unique target that has a + <code>go_prefix</code> transitive info provider. + </p> + </td> + </tr> + </tbody> +</table> + +<a name="go_library"></a> +## go\_library + +```python +go_library(name, srcs, deps, data) +``` +<table class="table table-condensed table-bordered table-params"> + <colgroup> + <col class="col-param" /> + <col class="param-description" /> + </colgroup> + <thead> + <tr> + <th colspan="2">Attributes</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>name</code></td> + <td> + <code>Name, required</code> + <p>A unique name for this rule.</p> + </td> + </tr> + <tr> + <td><code>srcs</code></td> + <td> + <code>List of labels, required</code> + <p>List of Go <code>.go</code> source files used to build the + library</p> + </td> + </tr> + <tr> + <td><code>deps</code></td> + <td> + <code>List of labels, optional</code> + <p>List of other libraries to linked to this library target</p> + </td> + </tr> + <tr> + <td><code>data</code></td> + <td> + <code>List of labels, optional</code> + <p>List of files needed by this rule at runtime.</p> + </td> + </tr> + </tbody> +</table> + +<a name="go_binary"></a> +## go\_binary + +```python +go_binary(name, srcs, deps, data) +``` +<table class="table table-condensed table-bordered table-params"> + <colgroup> + <col class="col-param" /> + <col class="param-description" /> + </colgroup> + <thead> + <tr> + <th colspan="2">Attributes</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>name</code></td> + <td> + <code>Name, required</code> + <p>A unique name for this rule.</p> + </td> + </tr> + <tr> + <td><code>srcs</code></td> + <td> + <code>List of labels, required</code> + <p>List of Go <code>.go</code> source files used to build the + binary</p> + </td> + </tr> + <tr> + <td><code>deps</code></td> + <td> + <code>List of labels, optional</code> + <p>List of other libraries to linked to this binary target</p> + </td> + </tr> + <tr> + <td><code>data</code></td> + <td> + <code>List of labels, optional</code> + <p>List of files needed by this rule at runtime.</p> + </td> + </tr> + </tbody> +</table> + +<a name="go_test"></a> +## go\_test + +```python +go_test(name, srcs, deps, data) +``` +<table class="table table-condensed table-bordered table-params"> + <colgroup> + <col class="col-param" /> + <col class="param-description" /> + </colgroup> + <thead> + <tr> + <th colspan="2">Attributes</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>name</code></td> + <td> + <code>Name, required</code> + <p>A unique name for this rule.</p> + </td> + </tr> + <tr> + <td><code>srcs</code></td> + <td> + <code>List of labels, required</code> + <p>List of Go <code>.go</code> source files used to build the + test</p> + </td> + </tr> + <tr> + <td><code>deps</code></td> + <td> + <code>List of labels, optional</code> + <p>List of other libraries to linked to this test target</p> + </td> + </tr> + <tr> + <td><code>data</code></td> + <td> + <code>List of labels, optional</code> + <p>List of files needed by this rule at runtime.</p> + </td> + </tr> + </tbody> +</table> |