1# Copyright 2018 The Bazel Authors. All rights reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15DEFAULT_NOGO = "@io_bazel_rules_go//:default_nogo" 16 17def _go_register_nogo_impl(ctx): 18 ctx.template( 19 "BUILD.bazel", 20 Label("//go/private:BUILD.nogo.bazel"), 21 substitutions = { 22 "{{nogo}}": ctx.attr.nogo, 23 }, 24 executable = False, 25 ) 26 27# go_register_nogo creates a repository with an alias that points 28# to the nogo rule that should be used globally by go rules in the workspace. 29# This may be called automatically by go_rules_dependencies or by 30# go_register_toolchains. 31go_register_nogo = repository_rule( 32 _go_register_nogo_impl, 33 attrs = { 34 "nogo": attr.string(mandatory = True), 35 }, 36) 37