mirror of
https://github.com/golang/go
synced 2024-11-21 21:24:45 -07:00
build: add build comments to core packages
The go/build package already recognizes system-specific file names like mycode_darwin.go mycode_darwin_386.go mycode_386.s However, it is also common to write files that apply to multiple architectures, so a recent CL added to go/build the ability to process comments listing a set of conditions for building. For example: // +build darwin freebsd openbsd/386 says that this file should be compiled only on OS X, FreeBSD, or 32-bit x86 OpenBSD systems. These conventions are not yet documented (hence this long CL description). This CL adds build comments to the multi-system files in the core library, a step toward making it possible to use go/build to build them. With this change go/build can handle crypto/rand, exec, net, path/filepath, os/user, and time. os and syscall need additional adjustments. R=golang-dev, r, gri, r, gustavo CC=golang-dev https://golang.org/cl/5011046
This commit is contained in:
parent
ef32eaceef
commit
2715956f13
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
// Unix cryptographically secure pseudorandom number
|
// Unix cryptographically secure pseudorandom number
|
||||||
// generator.
|
// generator.
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
package exec
|
package exec
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build openbsd
|
||||||
|
|
||||||
// Stub cgo routines for systems that do not use cgo to do network lookups.
|
// Stub cgo routines for systems that do not use cgo to do network lookups.
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
// DNS client: see RFC 1035.
|
// DNS client: see RFC 1035.
|
||||||
// Has to be linked into package net for Dial.
|
// Has to be linked into package net for Dial.
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
// Read system DNS config from /etc/resolv.conf
|
// Read system DNS config from /etc/resolv.conf
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd openbsd
|
||||||
|
|
||||||
// Network interface identification for BSD variants
|
// Network interface identification for BSD variants
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build plan9
|
||||||
|
|
||||||
// Network interface identification
|
// Network interface identification
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd windows
|
||||||
|
|
||||||
// (Raw) IP sockets
|
// (Raw) IP sockets
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd windows
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -52,7 +54,7 @@ func LookupCNAME(name string) (cname string, err os.Error) {
|
|||||||
// LookupSRV tries to resolve an SRV query of the given service,
|
// LookupSRV tries to resolve an SRV query of the given service,
|
||||||
// protocol, and domain name, as specified in RFC 2782. In most cases
|
// protocol, and domain name, as specified in RFC 2782. In most cases
|
||||||
// the proto argument can be the same as the corresponding
|
// the proto argument can be the same as the corresponding
|
||||||
// Addr.Network(). The returned records are sorted by priority
|
// Addr.Network(). The returned records are sorted by priority
|
||||||
// and randomized by weight within a priority.
|
// and randomized by weight within a priority.
|
||||||
func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err os.Error) {
|
func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err os.Error) {
|
||||||
target := "_" + service + "._" + proto + "." + name
|
target := "_" + service + "._" + proto + "." + name
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
// Read system port mappings from /etc/services
|
// Read system port mappings from /etc/services
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd openbsd
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd windows
|
||||||
|
|
||||||
// Sockets
|
// Sockets
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd
|
||||||
|
|
||||||
// Sockets for BSD variants
|
// Sockets for BSD variants
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd windows
|
||||||
|
|
||||||
// TCP sockets
|
// TCP sockets
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd windows
|
||||||
|
|
||||||
// UDP sockets
|
// UDP sockets
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd windows
|
||||||
|
|
||||||
// Unix domain sockets
|
// Unix domain sockets
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
// Unix environment variables.
|
// Unix environment variables.
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd windows
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
import syscall "syscall"
|
import syscall "syscall"
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd windows
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd windows
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build plan9
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
func itoa(val int) string { // do it here rather than with fmt to avoid dependency
|
func itoa(val int) string { // do it here rather than with fmt to avoid dependency
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd openbsd
|
||||||
|
|
||||||
// os code shared between *BSD systems including OS X (Darwin)
|
// os code shared between *BSD systems including OS X (Darwin)
|
||||||
// and FreeBSD.
|
// and FreeBSD.
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build openbsd plan9 windows
|
||||||
|
|
||||||
package user
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux
|
||||||
|
|
||||||
package user
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -9,6 +9,4 @@ GOFILES=\
|
|||||||
match.go\
|
match.go\
|
||||||
path.go\
|
path.go\
|
||||||
|
|
||||||
GOFILES+=$(GOFILES_$(GOOS))
|
|
||||||
|
|
||||||
include ../../Make.pkg
|
include ../../Make.pkg
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
package filepath
|
package filepath
|
||||||
|
|
||||||
import "strings"
|
import "strings"
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd openbsd
|
||||||
|
|
||||||
// Berkeley packet filter for BSD variants
|
// Berkeley packet filter for BSD variants
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
// Fork, exec, wait, etc.
|
// Fork, exec, wait, etc.
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd openbsd
|
||||||
|
|
||||||
// Routing sockets and messages
|
// Routing sockets and messages
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
// Socket control messages
|
// Socket control messages
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd openbsd
|
||||||
|
|
||||||
// BSD system call wrappers shared by *BSD based systems
|
// BSD system call wrappers shared by *BSD based systems
|
||||||
// including OS X (Darwin) and FreeBSD. Like the other
|
// including OS X (Darwin) and FreeBSD. Like the other
|
||||||
// syscall_*.go files it is compiled as Go code but also
|
// syscall_*.go files it is compiled as Go code but also
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
package time
|
package time
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd plan9
|
||||||
|
|
||||||
package time
|
package time
|
||||||
|
|
||||||
import "sync"
|
import "sync"
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd linux openbsd
|
||||||
|
|
||||||
// Parse "zoneinfo" time zone file.
|
// Parse "zoneinfo" time zone file.
|
||||||
// This is a fairly standard file format used on OS X, Linux, BSD, Sun, and others.
|
// This is a fairly standard file format used on OS X, Linux, BSD, Sun, and others.
|
||||||
// See tzfile(5), http://en.wikipedia.org/wiki/Zoneinfo,
|
// See tzfile(5), http://en.wikipedia.org/wiki/Zoneinfo,
|
||||||
|
Loading…
Reference in New Issue
Block a user