1
0
mirror of https://github.com/golang/go synced 2024-10-03 16:31:27 -06:00
Commit Graph

35 Commits

Author SHA1 Message Date
Robert Griesemer
398f220d5b gofmt-ify os
R=r
http://go/go-review/1017034
2009-11-04 20:42:40 -08:00
Russ Cox
c83b838641 package net cleanup
added ReadFrom/WriteTo for packet protocols like UDP.
simplified the net.Conn interface.
added new net.PacketConn interface for packet protocols.
implemented proper UDP listener.

cleaned up LocalAddr/RemoteAddr methods - cache in netFD.

threw away various unused methods.

an interface change:
introduced net.Addr as a network address interface,
to avoid conversion of UDP host:port to string and
back for every ReadFrom/WriteTo sequence.

another interface change:
since signature of Listener.Accept was changing anyway,
dropped the middle return value, because it is available
as c.RemoteAddr().  (the Accept signature predates the
existence of that method.)

Dial and Listen still accept strings, but the proto-specific
versions DialTCP, ListenUDP, etc. take net.Addr instead.

because the generic Dial didn't change and because
no one calls Accept directly (only indirectly via the http
server), very little code will be affected by these interface
changes.

design comments welcome.

R=p
CC=go-dev, r
http://go/go-review/1018017
2009-11-02 18:37:30 -08:00
Rob Pike
4d310f2434 reverse the arguments to io.Copy so the destination is on the
left, like an assignment, like strcpy, etc.

R=rsc
CC=go-dev
http://go/go-review/1016011
2009-11-01 20:59:49 -08:00
Russ Cox
fd1add2768 syscall cleanup.
* rename PORT.sh -> mkall.sh (hopefully more obvious),
   change behavior: run commands by default.
 * pull more constants out of #defines automatically,
   instead of editing large lists by hand.
 * add Recvfrom, Sendto

add os.O_EXCL.

R=r
http://go/go-review/1017009
2009-11-01 11:13:27 -08:00
Russ Cox
a64b69da9e os cleanup.
dir_* and stat_* are just os specific,
not os+arch-specific.

R=r
http://go/go-review/1018010
2009-11-01 09:37:13 -08:00
Rob Pike
449086eec9 Change Stat to Lstat in Readdir so we don't recur when someone symlinks "."
R=rsc
CC=go-dev
http://go/go-review/1018003
2009-10-29 10:53:37 -07:00
Russ Cox
d2829faa7c files that are okay from the last gofmt round
R=gri
http://go/go-review/1015011
2009-10-27 22:47:54 -07:00
Robert Griesemer
da829d6608 Work-around for factory function heuristic failure:
only associate a couple of functions as factories
for os.Error.

Replaces CL 35628 (abandoned).

R=rsc
DELTA=35  (26 added, 0 deleted, 9 changed)
OCL=35754
CL=35768
2009-10-15 09:24:19 -07:00
Russ Cox
094f1d5990 more lgtm files from gofmt
R=gri
OCL=35485
CL=35488
2009-10-08 15:14:54 -07:00
Russ Cox
2c5ec1ebc0 apply gofmt to malloc math once os
R=gri
DELTA=566  (4 added, 14 deleted, 548 changed)
OCL=35410
CL=35419
2009-10-06 19:40:35 -07:00
Russ Cox
b428456df6 nacl syscall package.
similar tweaks to make debug/proc, net, os build.

R=r
DELTA=861  (855 added, 4 deleted, 2 changed)
OCL=34877
CL=34890
2009-09-22 07:49:31 -07:00
Rob Pike
7be770071f use buf.String() instead of string(buf.Bytes())
use strings.Buffer instead of bytes.Buffer in some places

R=rsc
DELTA=40  (0 added, 3 deleted, 37 changed)
OCL=34770
CL=34775
2009-09-17 23:51:06 -07:00
Russ Cox
20011bc878 unused imports
R=r
OCL=34731
CL=34731
2009-09-17 10:27:04 -07:00
Rob Pike
d5be41fc4e rename bytes.Buffer.Data() to bytes.Buffer.Bytes()
R=rsc
DELTA=152  (6 added, 0 deleted, 146 changed)
OCL=34695
CL=34701
2009-09-16 15:15:00 -07:00
Russ Cox
ca6a0fee1b more "declared and not used".
the last round omitted := range and only
checked 1 out of N vars in a multi-var :=

R=r
OCL=34624
CL=34638
2009-09-15 09:41:59 -07:00
Russ Cox
28eba4877b fix "declared and not used" errors in non-test code.
R=r
DELTA=112  (6 added, 57 deleted, 49 changed)
OCL=34610
CL=34610
2009-09-14 17:20:29 -07:00
Kai Backman
ee31157e16 64 bit lsh, sub, and/or/eor. some placeholder files in syscall and os.
R=rsc
APPROVED=rsc
DELTA=204  (139 added, 0 deleted, 65 changed)
OCL=34009
CL=34025
2009-08-28 07:23:24 -07:00
Russ Cox
f7e92c596c os.File.ReadAt/WriteAt
R=r
DELTA=84  (81 added, 0 deleted, 3 changed)
OCL=34006
CL=34006
2009-08-27 18:36:45 -07:00
Russ Cox
3b864e4195 convert low-level (used by testing) packages to
whole-package compilation.  new Makefiles,
tests now in separate package

	bytes
	flag
	fmt
	io
	math
	once
	os
	reflect
	strconv
	sync
	time
	utf8

delete import "xxx" in package xxx.

inside package xxx, xxx is not declared
anymore so s/xxx.//g

delete file and package level forward declarations.

note the new internal_test.go and sync
and strconv to provide public access to
internals during testing.  the installed version
of the package omits that file and thus does
not open the internals to all clients.

R=r
OCL=33065
CL=33097
2009-08-12 13:18:37 -07:00
Russ Cox
0496040bd6 remove unnecessary pkg. references
R=r
DELTA=95  (0 added, 0 deleted, 95 changed)
OCL=33012
CL=33012
2009-08-10 22:02:51 -07:00
Austin Clements
3776f31144 Make os.RemoveAll return no error if path does not exist.
This fixes a problem introduced by CL 32684 into gobuild,
which used to use 'rm -rf' to remove the _obj directory.

R=rsc
APPROVED=rsc
DELTA=8  (4 added, 0 deleted, 4 changed)
OCL=32794
CL=32796
2009-08-05 14:18:54 -07:00
Rob Pike
7d94cfdfb9 /usr/local/bin might not exist so use /usr/bin in the chdir test.
R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=31708
CL=31713
2009-07-15 21:28:08 -07:00
Austin Clements
d0e29f2852 Pretty printer for os.Waitmsg
R=rsc
APPROVED=rsc
DELTA=49  (49 added, 0 deleted, 0 changed)
OCL=31568
CL=31671
2009-07-15 09:58:42 -07:00
Austin Clements
ffb4b0d7b7 Avoid clash between os.WRUSAGE and Linux's WALL flag.
R=rsc
APPROVED=rsc
DELTA=5  (4 added, 0 deleted, 1 changed)
OCL=31564
CL=31567
2009-07-13 19:28:00 -07:00
Russ Cox
55e790a160 clean up some BUG/TODO in go code
R=r
DELTA=23  (1 added, 12 deleted, 10 changed)
OCL=30957
CL=30980
2009-07-01 07:32:04 -07:00
Russ Cox
d3a412a5ab io.StringBytes -> strings.Bytes
io.ByteBuffer -> bytes.Buffer

left io.ByteBuffer stub around for now,
for protocol compiler.

R=r
OCL=30861
CL=30872
2009-06-29 15:24:23 -07:00
Russ Cox
8f9a953760 make use of forward method declaration
R=r
DELTA=11  (0 added, 6 deleted, 5 changed)
OCL=30862
CL=30870
2009-06-29 15:13:56 -07:00
Russ Cox
b32769b1a3 add os.Hostname
R=r
DELTA=188  (182 added, 3 deleted, 3 changed)
OCL=30856
CL=30860
2009-06-29 13:44:46 -07:00
Rob Pike
d330c712c1 Getenv: almost no one wants the error, so make it return a string that may be empty.
Getenverror is the new name for the old routine that returns an error too.

R=rsc
DELTA=35  (7 added, 7 deleted, 21 changed)
OCL=30818
CL=30821
2009-06-26 20:28:41 -07:00
Russ Cox
a0bcaf4c00 Change os.Error convention:
echo back context of call in error if likely to be useful.

For example, if os.Open("/etc/passwd", os.O_RDONLY)
fails with syscall.EPERM, it returns as the os.Error

	&PathError{
		Op: "open",
		Path: "/etc/passwd"
		Error: os.EPERM
	}

which formats as

	open /etc/passwd: permission denied

Not converted:

	datafmt
	go/...
	google/...
	regexp
	tabwriter
	template

R=r
DELTA=1153  (561 added, 156 deleted, 436 changed)
OCL=30738
CL=30781
2009-06-25 20:24:55 -07:00
Russ Cox
6af5775d74 dreg
R=r
DELTA=19  (0 added, 19 deleted, 0 changed)
OCL=30739
CL=30751
2009-06-25 14:25:11 -07:00
Russ Cox
a50cbf6c73 style police: parens in if, for, switch, range
R=r
DELTA=32  (0 added, 3 deleted, 29 changed)
OCL=30718
CL=30725
2009-06-24 20:12:50 -07:00
Russ Cox
64684cc2a2 introduce os.EOF and io.ErrUnexpectedEOF.
remove io.ErrEOF.
rename io.FullRead to io.ReadFull, to match
   ReadAtLeast and ReadAll.
remove io.FullReader, because it is now unused.

R=r
DELTA=295  (88 added, 105 deleted, 102 changed)
OCL=30544
CL=30588
2009-06-22 13:26:13 -07:00
Russ Cox
76c87d58cd 386 system call fixes:
* use 64-bit file system calls (Linux, Darwin)
  * use 32-bit [sic] uid/gid calls (Linux)
  * fix sockets on Linux

Darwin/386 works again.

Linux/386 is better but must never have worked;
there are still bugs surrounding the creation of new
threads in the runtime package.

R=austin
DELTA=1332  (673 added, 614 deleted, 45 changed)
OCL=30327
CL=30380
2009-06-16 17:17:02 -07:00
Rob Pike
d90e7cbac6 mv src/lib to src/pkg
tests: all.bash passes, gobuild still works, godoc still works.

R=rsc
OCL=30096
CL=30102
2009-06-09 09:53:44 -07:00