blob: 54157014d5c3b8a792edace10cf172332c90604a [file] [log] [blame]
/*
* Copyright 2018-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
{namespace go_common}
/***/
{template .supported_language_version}
Buck currently supports Go version 1.10.
{/template}
/***/
{template .deps_arg}
{call buck.arg}
{param name : 'deps' /}
{param default : '[]' /}
{param desc}
The set of dependencies of this rule. Currently, this only supports go_library rules.
{/param}
{/call}
{/template}
/***/
{template .srcs_arg}
{call buck.arg}
{param name : 'srcs' /}
{param desc}
<p>
The set of source files to be compiled by this rule. .go files will be compiled with the Go
compiler, .s files will be compiled with the assembler, and everything else is assumed to be
files that may be <code>#include</code>d by the assembler.
</p>
{/param}
{/call}
{/template}
/***/
{template .link_style_arg}
{call buck.arg}
{param name : 'link_style' /}
{param default: 'static_pic' /}
{param desc}
Determines whether to build and link this rule's dependencies statically or dynamically. Can be
one of the following values: <code>static</code>, <code>static_pic</code> or <code>shared</code>.
This argument is relevant only if the cgo extension is enabled. Otherwise, Buck ignores this argument.
{/param}
{/call}
{/template}
/***/
{template .link_mode_arg}
{call buck.arg}
{param name : 'link_mode' /}
{param default: '' /}
{param desc}
Determines the link mode (equivalent of <code>-mode</code>). Can be one of the following
values: <code>internal</code>, <code>external</code>.
If no value is provided, the mode is set automatically depending on the other args.
{/param}
{/call}
{/template}
/***/
{template .cgo_compiler_flags_arg}
{call buck.arg}
{param name : 'cgo_compiler_flags_arg' /}
{param default : '[]' /}
{param desc}
<p>
The set of additional compiler flags to pass to <code>go tool cgo</code>.
</p>
{/param}
{/call}
{/template}
/***/
{template .package_name_arg}
{call buck.arg}
{param name : 'package_name' /}
{param default : 'go.prefix + path relative to the buck root' /}
{param desc}
Sets the full name of the package being compiled. This defaults to the path from the buck root.
(e.g. given a ./.buckconfig, a rule in ./a/b/BUCK defaults to package "a/b")
{/param}
{/call}
{/template}
/***/
{template .compiler_flags_arg}
{call buck.arg}
{param name : 'compiler_flags' /}
{param default : '[]' /}
{param desc}
The set of additional compiler flags to pass to <code>go tool compile</code>.
{/param}
{/call}
{/template}
/***/
{template .assembler_flags_arg}
{call buck.arg}
{param name : 'assembler_flags' /}
{param default : '[]' /}
{param desc}
The set of additional assembler flags to pass to <code>go tool asm</code>.
{/param}
{/call}
{/template}
/***/
{template .linker_flags_arg}
{call buck.arg}
{param name: 'linker_flags' /}
{param default: '[]' /}
{param desc}
Extra linker flags passed to go link
{/param}
{/call}
{/template}
/***/
{template .external_linker_flags_arg}
{call buck.arg}
{param name: 'external_linker_flags' /}
{param default: '[]' /}
{param desc}
Extra external linker flags passed to go link via <code>-extld</code> argument.
If argument is non-empty or <code>cgo_library</code> is used, the link mode
will switch to <code>external</code>.
{/param}
{/call}
{/template}
/***/
{template .more_examples}
<p>
For more examples, check out our <a
href="https://github.com/facebook/buck/tree/master/test/com/facebook/buck/features/go/testdata">
integration tests</a>.
</p>
{/template}