1
0
mirror of https://github.com/golang/go synced 2024-11-23 07:20:06 -07:00

crypto/x509/internal/macos: rename package to lowercase

Also add a test to lock in this policy.

Fixes #40065

Change-Id: Iedc4586f2f5598046d84132a8f3bba8f2e93ddc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/241274
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Filippo Valsorda 2020-07-07 14:04:18 -04:00
parent 9699086043
commit 4f2a2d7e26
7 changed files with 25 additions and 5 deletions

View File

@ -8,7 +8,7 @@ package x509
import (
"bytes"
"crypto/x509/internal/macOS"
macOS "crypto/x509/internal/macos"
"fmt"
"os"
"strings"

View File

@ -10,6 +10,7 @@ package build
import (
"bytes"
"fmt"
"internal/testenv"
"io/ioutil"
"os"
"path/filepath"
@ -387,7 +388,7 @@ var depsRules = `
< golang.org/x/crypto/poly1305
< golang.org/x/crypto/chacha20poly1305
< golang.org/x/crypto/hkdf
< crypto/x509/internal/macOS
< crypto/x509/internal/macos
< crypto/x509/pkix
< crypto/x509
< crypto/tls;
@ -516,8 +517,7 @@ func listStdPkgs(goroot string) ([]string, error) {
}
func TestDependencies(t *testing.T) {
iOS := runtime.GOOS == "darwin" && runtime.GOARCH == "arm64"
if iOS {
if !testenv.HasSrc() {
// Tests run in a limited file system and we do not
// provide access to every source file.
t.Skipf("skipping on %s/%s, missing full GOROOT", runtime.GOOS, runtime.GOARCH)
@ -805,3 +805,23 @@ func (p *depsParser) nextToken() string {
}
}
}
// TestStdlibLowercase tests that all standard library package names are
// lowercase. See Issue 40065.
func TestStdlibLowercase(t *testing.T) {
if !testenv.HasSrc() {
t.Skipf("skipping on %s/%s, missing full GOROOT", runtime.GOOS, runtime.GOARCH)
}
ctxt := Default
all, err := listStdPkgs(ctxt.GOROOT)
if err != nil {
t.Fatal(err)
}
for _, pkgname := range all {
if strings.ToLower(pkgname) != pkgname {
t.Errorf("package %q should not use upper-case path", pkgname)
}
}
}

View File

@ -129,7 +129,7 @@ func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintpt
// syscallNoErr is used in crypto/x509 to call into Security.framework and CF.
//go:linkname crypto_x509_syscall crypto/x509/internal/macOS.syscall
//go:linkname crypto_x509_syscall crypto/x509/internal/macos.syscall
//go:nosplit
//go:cgo_unsafe_args
func crypto_x509_syscall(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1 uintptr) {