mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.boringcrypto] go/build: satisfy the boringcrypto build tag
This will let applications target Go+BoringCrypto specific APIs cleanly. Change-Id: I49cbe3a7f044be043f1b98c53112e5147914eaed Reviewed-on: https://go-review.googlesource.com/c/go/+/250500 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Trust: Filippo Valsorda <filippo@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
This commit is contained in:
parent
ef2b318974
commit
f9b86a6562
3 changed files with 21 additions and 0 deletions
|
|
@ -6,6 +6,9 @@
|
|||
// Go+BoringCrypto. This package is available on all targets as long as the
|
||||
// Go+BoringCrypto toolchain is used. Use the Enabled function to determine
|
||||
// whether the BoringCrypto core is actually in use.
|
||||
//
|
||||
// Any time the Go+BoringCrypto toolchain is used, the "boringcrypto" build tag
|
||||
// is satisfied, so that applications can tag files that use this package.
|
||||
package boring
|
||||
|
||||
import "crypto/internal/boring"
|
||||
|
|
|
|||
13
src/crypto/boring/notboring_test.go
Normal file
13
src/crypto/boring/notboring_test.go
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2020 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !boringcrypto
|
||||
|
||||
package boring_test
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNotBoring(t *testing.T) {
|
||||
t.Error("a file tagged !boringcrypto should not build under Go+BoringCrypto")
|
||||
}
|
||||
|
|
@ -1697,6 +1697,7 @@ func splitQuoted(s string) (r []string, err error) {
|
|||
// $GOARCH
|
||||
// cgo (if cgo is enabled)
|
||||
// !cgo (if cgo is disabled)
|
||||
// boringcrypto
|
||||
// ctxt.Compiler
|
||||
// !ctxt.Compiler
|
||||
// tag (if tag is listed in ctxt.BuildTags or ctxt.ReleaseTags)
|
||||
|
|
@ -1748,6 +1749,10 @@ func (ctxt *Context) match(name string, allTags map[string]bool) bool {
|
|||
if ctxt.GOOS == "illumos" && name == "solaris" {
|
||||
return true
|
||||
}
|
||||
// Let applications know that the Go+BoringCrypto toolchain is in use.
|
||||
if name == "boringcrypto" {
|
||||
return true
|
||||
}
|
||||
|
||||
// other tags
|
||||
for _, tag := range ctxt.BuildTags {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue