]> Cypherpunks repositories - gostls13.git/commitdiff
build: add build comments to core packages
authorRuss Cox <rsc@golang.org>
Thu, 15 Sep 2011 20:48:57 +0000 (16:48 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 15 Sep 2011 20:48:57 +0000 (16:48 -0400)
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

45 files changed:
src/pkg/crypto/rand/rand_unix.go
src/pkg/exec/lp_unix.go
src/pkg/net/cgo_bsd.go
src/pkg/net/cgo_stub.go
src/pkg/net/cgo_unix.go
src/pkg/net/dnsclient_unix.go
src/pkg/net/dnsconfig.go
src/pkg/net/fd.go
src/pkg/net/file.go
src/pkg/net/interface_bsd.go
src/pkg/net/interface_stub.go
src/pkg/net/iprawsock_posix.go
src/pkg/net/ipsock_posix.go
src/pkg/net/lookup_unix.go
src/pkg/net/newpollserver.go
src/pkg/net/port.go
src/pkg/net/sendfile_stub.go
src/pkg/net/sock.go
src/pkg/net/sock_bsd.go
src/pkg/net/tcpsock_posix.go
src/pkg/net/udpsock_posix.go
src/pkg/net/unixsock_posix.go
src/pkg/os/dir_unix.go
src/pkg/os/env_unix.go
src/pkg/os/error_posix.go
src/pkg/os/exec_posix.go
src/pkg/os/exec_unix.go
src/pkg/os/file_posix.go
src/pkg/os/file_unix.go
src/pkg/os/path_unix.go
src/pkg/os/str.go
src/pkg/os/sys_bsd.go
src/pkg/os/user/lookup_stubs.go
src/pkg/os/user/lookup_unix.go
src/pkg/path/Makefile
src/pkg/path/filepath/path_unix.go
src/pkg/syscall/bpf_bsd.go
src/pkg/syscall/exec_unix.go
src/pkg/syscall/route_bsd.go
src/pkg/syscall/sockcmsg_unix.go
src/pkg/syscall/syscall_bsd.go
src/pkg/syscall/syscall_unix.go
src/pkg/time/sys_unix.go
src/pkg/time/zoneinfo_posix.go
src/pkg/time/zoneinfo_unix.go

index 3a06aa8b148954a4301d47084391de05de94291a..76a7365b7fe694819494079ad4716505dd99e250 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 // Unix cryptographically secure pseudorandom number
 // generator.
 
index 008fb11a81c01186193a1fab5119cd72eee28391..0cd19e7ac9004e89a0791e0ca16254d83e6a1442 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 package exec
 
 import (
index 4984df4a2c551ce0257ae73dd05264cd4822b8f0..63750f7a3dbd2d2e9e295454584fcb10d5943fb8 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd
+
 package net
 
 /*
index c6277cb657cbafd1b9d8090b70c9ec663a76e2eb..565cbe7fece4a4df6ba2cabb35478da8953275f2 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // 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.
 
 package net
index a3711d6012880e9a0f0722da554e0588749b43e3..ec2a393e8155096f6c2e8c5c75f5821f97f5ac9e 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux
+
 package net
 
 /*
index cb46455091c50f962bfa2a0ff3411e3a7e636b9e..a28eb16158477e27389887511d7022d589c8a5b2 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 // DNS client: see RFC 1035.
 // Has to be linked into package net for Dial.
 
index 54e334342adf11ef35d34e5adf63e5be14b5df99..afc059917738366eeaccdf47bd30852311aae5ce 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 // Read system DNS config from /etc/resolv.conf
 
 package net
index 707dccaa421392ef7851cad76fe0d57c0e84cce9..9084e88755e995a471a1bd9aef8afaa7109708cd 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 package net
 
 import (
index 0e411a192f2393715e6b03e9ccc7a4c12a68446c..d8528e41bda72518afbbcce962c1e72affe71b6f 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 package net
 
 import (
index 2675f94b973481623120d66a0319647503a0bdc3..9171827d22c28f9fd7cbb35e101c8ce048e49928 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd openbsd
+
 // Network interface identification for BSD variants
 
 package net
index 950de6c592646ed07b7dc1b7be7177fe4e71d726..282b38b5e491e82c7b371ab28f7398f7cbfd955d 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build plan9
+
 // Network interface identification
 
 package net
index 5cbc5887024f70c9c02656a0175d3a1ec53cd08c..35aceb2233449ed2e6e73dfc9333877ba72ce167 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd windows
+
 // (Raw) IP sockets
 
 package net
index 0c522fb7fbe64d4a1e8de4749fdaea2058c343f0..049df9ea4cbaac6bd947094c4ae75b59405a4df6 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd windows
+
 package net
 
 import (
index 309f14ec300379af36544a6a18eaf2463fe3b045..7368b751ee002924261e5e9038242662300de5c4 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 package net
 
 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,
 // protocol, and domain name, as specified in RFC 2782. In most cases
 // 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.
 func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err os.Error) {
        target := "_" + service + "._" + proto + "." + name
index 427208701b35f64715cf08b34ee5ddf35b03201c..3c9a6da53739f71abdff0c59a34f5c2e9c44c0c3 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 package net
 
 import (
index 8f8327a3733d573994a0e53d760e36aacadbb17d..a8ca60c60aab46820ef6968d1ec8bd051ec06892 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 // Read system port mappings from /etc/services
 
 package net
index 43e8104e94c36497eb0c1394ebdeb3efdd411d92..c55be6c0801dc43716d6d0a93a4f8729508c6660 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd openbsd
+
 package net
 
 import (
index 821716e43bda15ffa3186fddc1d87b7f6d34d2dc..366e050ff3be56099e6df7ef525b52308f52f1c4 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd windows
+
 // Sockets
 
 package net
index 5fd52074ad360283bd2f53ebf0a5102c0977dfb9..c59802fecb3edf3c7e83182bd9ec957ed2c83622 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd
+
 // Sockets for BSD variants
 
 package net
index f2e9197027670b6db6c59bf008493c5cb28e23da..35d536c319acf0d5caab9d047c6696929c8ad899 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd windows
+
 // TCP sockets
 
 package net
index 1dc79f736a810850f9f0197fc03c8237502e9ce4..06298ee40c8fbab761577e942986ca00032792b5 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd windows
+
 // UDP sockets
 
 package net
index 38c6fe9eb1e6549a9dc4d1618fc525dfcc9b816e..fccf0189c05a388c2d5fc675440ec306225a7862 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd windows
+
 // Unix domain sockets
 
 package net
index 7835ed52b559daafc3047cfe3a53d46f882e80da..529593395129aeecace2cb5d3b0421dfa6aa274d 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 package os
 
 import (
index 9cc0b03d8776e24fb6c3209b5bb8572230343d43..8dd84ae4f3a24e534edd6f64ae898e9b32c734c4 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 // Unix environment variables.
 
 package os
index d43f1786d373fe2b0041d560702c61a686e0ea7e..9dc258a796b02603583380adb0648ee8cae6265d 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd windows
+
 package os
 
 import syscall "syscall"
index f37bfab589aa79b47fbdf93847275286f9997fbf..035b156cbdc0ac76153c0ff2901a6b45acccf26d 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd windows
+
 package os
 
 import (
index 41e77230ad5a466a6c5da08a03bba3a3db7d881e..e1adb203e0af0be2a3af947fca29c7fc870837c6 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 package os
 
 import (
index ff8554bfc8f2133f75b5dc52c126ca2663f51ac0..5269149565b36a0b744ba7d39afdafa44f8b3334 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd windows
+
 package os
 
 import (
index ab32ce98d458cce8aae40e36953d3b12e3582c72..a4470f1b428cf8bffc251d6f6d96b8c5f54cc0d7 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 package os
 
 import (
index 0d327cddd3ea85e13a2ed83ef210cf706fe4528d..33045b60c4580887dde1be5f8badf5e14b7df8e9 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 package os
 
 const (
index 8dc9e4747dfb3e673bdb393a036165b4a274a13a..e3606b61eb4c075eb90f961c4f76443aa246b79e 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build plan9
+
 package os
 
 func itoa(val int) string { // do it here rather than with fmt to avoid dependency
index 188993b696120387b937d9c5a01697eb9a5f4c20..b0d097a22a2722b98aef7e4f55567ce2208fc6bc 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd openbsd
+
 // os code shared between *BSD systems including OS X (Darwin)
 // and FreeBSD.
 
index 2f08f70fd5760212c599b6cc26c952017eb40bdd..2d2de989f0627f5c188e82bbe89a41b8b981a418 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build openbsd plan9 windows
+
 package user
 
 import (
index 1b2c9e8c9937ba2d8adf222dfeb4645be7b29fa7..817eb791cb2683c9cda0aa53833a1de56ea96d2b 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux
+
 package user
 
 import (
index fc3e2519cecc7bb9acd99b8fff2978ae17ccc856..a7e05714a96cb599ea53869b4c70bc7e79b007f1 100644 (file)
@@ -9,6 +9,4 @@ GOFILES=\
        match.go\
        path.go\
 
-GOFILES+=$(GOFILES_$(GOOS))
-
 include ../../Make.pkg
index b2a4151c1a85f595141db3f1809247aba05dc418..daf0eb2af7c2ef8664105030135f49c0c8dd9d05 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 package filepath
 
 import "strings"
index 1eac9a3d8dc5afb2a46120871d8467248372b582..06a2953e7fed9f989f5077ee78331b620c63065f 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd openbsd
+
 // Berkeley packet filter for BSD variants
 
 package syscall
index 94f075622cebfc0fd4ec1d271e8a60d6780ee246..2399c89cc5a8c010c14e2a97c3f82a794fc21c9b 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 // Fork, exec, wait, etc.
 
 package syscall
index 22a0a4f80e806775178032586f0ce63c9d49c302..f6b124b64e474fe56a63785c4328900345eea46b 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd openbsd
+
 // Routing sockets and messages
 
 package syscall
index b437560e7092f7129b745903a53b03b180f1d015..c9872aeba31ed35adfc24699b69c0649e1e10fa7 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 // Socket control messages
 
 package syscall
index f59e8b10950b502a612b0f5bcc5106f1b28e45d7..59c6f4560bf2c0592ddbec059ac7ec638647791d 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd openbsd
+
 // BSD system call wrappers shared by *BSD based systems
 // including OS X (Darwin) and FreeBSD.  Like the other
 // syscall_*.go files it is compiled as Go code but also
index c298b91b43ac424bd81a3f7d289c7a2f32551382..1590b6d4f2a12ccc011775a483f103da2e50a2fb 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 package syscall
 
 import (
index 0f9128e20ae4c356ce02fbb21392fd95f264dd95..0119bdf7bf91c4bb6c520a9dd91cf54265059349 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 package time
 
 import (
index b49216410ffa2eeb27a74f253c3510f2539cf75d..b0fa6c33b65afc4dc1f7538d18b30bc3ee7bb58e 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd plan9
+
 package time
 
 import "sync"
index ce4d9f13af164e2390e2eacb1c3b3998d4a44e79..0dc423531366af18b7674dd07b311bdde0fdb007 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build darwin freebsd linux openbsd
+
 // Parse "zoneinfo" time zone file.
 // 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,