|
|
Created:
14 years, 11 months ago by brad_danga_com Modified:
14 years, 9 months ago Reviewers:
CC:
rsc, r, golang-dev Visibility:
Public. |
Descriptionos: add Utime function
Patch Set 1 #Patch Set 2 : code review 1103041: os: add Utime function #
Total comments: 4
Patch Set 3 : code review 1103041: os: add Utime function #Patch Set 4 : code review 1103041: os: add Utime function #Patch Set 5 : code review 1103041: os: add Utime function #
Total comments: 4
Patch Set 6 : code review 1103041: os: add Utime function #MessagesTotal messages: 19
Hello rsc (cc: golang-dev@googlegroups.com), I'd like you to review this change.
Sign in to reply to this message.
LGTM leaving for rsc http://codereview.appspot.com/1103041/diff/2001/3002 File src/pkg/os/os_test.go (right): http://codereview.appspot.com/1103041/diff/2001/3002#newcode493 src/pkg/os/os_test.go:493: fd.Write([]byte("hello, world\n")) you could use WriteString and let the library do the conversion. your choice. http://codereview.appspot.com/1103041/diff/2001/3002#newcode502 src/pkg/os/os_test.go:502: const SecondNanos = 1000000000 how about const OneSecond = 1e9 // units of nanoseconds
Sign in to reply to this message.
Hello rsc, r (cc: golang-dev@googlegroups.com), Please take another look.
Sign in to reply to this message.
Hello rsc, r (cc: golang-dev@googlegroups.com), Please take another look.
Sign in to reply to this message.
PTAL http://codereview.appspot.com/1103041/diff/2001/3002 File src/pkg/os/os_test.go (right): http://codereview.appspot.com/1103041/diff/2001/3002#newcode493 src/pkg/os/os_test.go:493: fd.Write([]byte("hello, world\n")) On 2010/05/05 00:56:07, r wrote: > you could use WriteString and let the library do the conversion. your choice. I didn't want to break consistency with the rest of this file. http://codereview.appspot.com/1103041/diff/2001/3002#newcode502 src/pkg/os/os_test.go:502: const SecondNanos = 1000000000 On 2010/05/05 00:56:07, r wrote: > how about > const OneSecond = 1e9 // units of nanoseconds Done.
Sign in to reply to this message.
i still think that Chtime or Chtimes would be a better name for this call, given that the name Utime doesn't correspond directly to the system call name. under Windows, the name Utime would be even less appropriate, as the the relevant call is SetFileInformationByHandle. On 5 May 2010 15:36, <bradfitz@gmail.com> wrote: > PTAL > > > http://codereview.appspot.com/1103041/diff/2001/3002 > File src/pkg/os/os_test.go (right): > > http://codereview.appspot.com/1103041/diff/2001/3002#newcode493 > src/pkg/os/os_test.go:493: fd.Write([]byte("hello, world\n")) > On 2010/05/05 00:56:07, r wrote: >> >> you could use WriteString and let the library do the conversion. your > > choice. > > I didn't want to break consistency with the rest of this file. > > http://codereview.appspot.com/1103041/diff/2001/3002#newcode502 > src/pkg/os/os_test.go:502: const SecondNanos = 1000000000 > On 2010/05/05 00:56:07, r wrote: >> >> how about >> const OneSecond = 1e9 // units of nanoseconds > > Done. > > http://codereview.appspot.com/1103041/show >
Sign in to reply to this message.
I'm happy with whatever, including Chtimes. The win32 argument is good, but I imagine pkg os already has a bunch of Unix-isms in it that don't map to Windows names either, so consistency with that naming family might be preferred over deviating in a few places. I'll leave this to Russ and Rob to decide, though. - Brad On Wed, May 5, 2010 at 8:21 AM, roger peppe <rogpeppe@gmail.com> wrote: > i still think that Chtime or Chtimes would be a better name > for this call, given that the name Utime doesn't > correspond directly to the system call name. under > Windows, the name Utime would be even less appropriate, as the > the relevant call is SetFileInformationByHandle. > > > > On 5 May 2010 15:36, <bradfitz@gmail.com> wrote: > > PTAL > > > > > > http://codereview.appspot.com/1103041/diff/2001/3002 > > File src/pkg/os/os_test.go (right): > > > > http://codereview.appspot.com/1103041/diff/2001/3002#newcode493 > > src/pkg/os/os_test.go:493: fd.Write([]byte("hello, world\n")) > > On 2010/05/05 00:56:07, r wrote: > >> > >> you could use WriteString and let the library do the conversion. your > > > > choice. > > > > I didn't want to break consistency with the rest of this file. > > > > http://codereview.appspot.com/1103041/diff/2001/3002#newcode502 > > src/pkg/os/os_test.go:502: const SecondNanos = 1000000000 > > On 2010/05/05 00:56:07, r wrote: > >> > >> how about > >> const OneSecond = 1e9 // units of nanoseconds > > > > Done. > > > > http://codereview.appspot.com/1103041/show > > >
Sign in to reply to this message.
On Wed, May 5, 2010 at 08:21, roger peppe <rogpeppe@gmail.com> wrote: > i still think that Chtime or Chtimes would be a better name > for this call, given that the name Utime doesn't > correspond directly to the system call name. under > Windows, the name Utime would be even less appropriate, as the > the relevant call is SetFileInformationByHandle. utime does correspond directly to the original system call. the s variant was added to add sub-second precision. i agree that it's a clumsy name, but it's what people coming from unix (which is a lot of our developers) expect, and no one expects Chtime. (and SetFileInformationByHandle is right out.)
Sign in to reply to this message.
i guess. FWIW, there are other functions in os that don't correspond directly to their unix equivalents (e.g. Remove, ReadAt), so i don't think it would matter so much if Chtime was similarly different. it's not hard to look up. i don't think there are any other functions in os that modify the environment that don't have an active verb in the name. On 5 May 2010 17:34, Russ Cox <rsc@golang.org> wrote: > On Wed, May 5, 2010 at 08:21, roger peppe <rogpeppe@gmail.com> wrote: >> i still think that Chtime or Chtimes would be a better name >> for this call, given that the name Utime doesn't >> correspond directly to the system call name. under >> Windows, the name Utime would be even less appropriate, as the >> the relevant call is SetFileInformationByHandle. > > utime does correspond directly to the original system call. > the s variant was added to add sub-second precision. > i agree that it's a clumsy name, but it's what people > coming from unix (which is a lot of our developers) > expect, and no one expects Chtime. > (and SetFileInformationByHandle is right out.) >
Sign in to reply to this message.
Arguably, "U" is Update in the same way "Ch" is Change, if you're calling "Ch" a verb. On Wed, May 5, 2010 at 10:09 AM, roger peppe <rogpeppe@gmail.com> wrote: > i guess. > > FWIW, there are other functions in os that don't correspond > directly to their unix equivalents (e.g. Remove, ReadAt), > so i don't think it would matter so much if Chtime was similarly > different. it's not hard to look up. > > i don't think there are any other functions in os that modify > the environment that don't have an active verb in the name. > > > > On 5 May 2010 17:34, Russ Cox <rsc@golang.org> wrote: > > On Wed, May 5, 2010 at 08:21, roger peppe <rogpeppe@gmail.com> wrote: > >> i still think that Chtime or Chtimes would be a better name > >> for this call, given that the name Utime doesn't > >> correspond directly to the system call name. under > >> Windows, the name Utime would be even less appropriate, as the > >> the relevant call is SetFileInformationByHandle. > > > > utime does correspond directly to the original system call. > > the s variant was added to add sub-second precision. > > i agree that it's a clumsy name, but it's what people > > coming from unix (which is a lot of our developers) > > expect, and no one expects Chtime. > > (and SetFileInformationByHandle is right out.) > > >
Sign in to reply to this message.
ah, maybe that's the case. my addled brain could only make "user", which naturally made no sense. in my defense, the man page (on os x at least) doesn't contain the word "update". On 5 May 2010 18:11, Brad Fitzpatrick <brad@danga.com> wrote: > Arguably, "U" is Update in the same way "Ch" is Change, if you're calling > "Ch" a verb. > On Wed, May 5, 2010 at 10:09 AM, roger peppe <rogpeppe@gmail.com> wrote: >> >> i guess. >> >> FWIW, there are other functions in os that don't correspond >> directly to their unix equivalents (e.g. Remove, ReadAt), >> so i don't think it would matter so much if Chtime was similarly >> different. it's not hard to look up. >> >> i don't think there are any other functions in os that modify >> the environment that don't have an active verb in the name. >> >> >> >> On 5 May 2010 17:34, Russ Cox <rsc@golang.org> wrote: >> > On Wed, May 5, 2010 at 08:21, roger peppe <rogpeppe@gmail.com> wrote: >> >> i still think that Chtime or Chtimes would be a better name >> >> for this call, given that the name Utime doesn't >> >> correspond directly to the system call name. under >> >> Windows, the name Utime would be even less appropriate, as the >> >> the relevant call is SetFileInformationByHandle. >> > >> > utime does correspond directly to the original system call. >> > the s variant was added to add sub-second precision. >> > i agree that it's a clumsy name, but it's what people >> > coming from unix (which is a lot of our developers) >> > expect, and no one expects Chtime. >> > (and SetFileInformationByHandle is right out.) >> > > >
Sign in to reply to this message.
i can go either way but i must admit i like Chtime[s] better. -rob On May 5, 2010, at 10:32 AM, roger peppe wrote: > ah, maybe that's the case. my addled brain could > only make "user", which naturally made no sense. > in my defense, the man page (on os x at least) doesn't > contain the word "update". > > On 5 May 2010 18:11, Brad Fitzpatrick <brad@danga.com> wrote: >> Arguably, "U" is Update in the same way "Ch" is Change, if you're >> calling >> "Ch" a verb. >> On Wed, May 5, 2010 at 10:09 AM, roger peppe <rogpeppe@gmail.com> >> wrote: >>> >>> i guess. >>> >>> FWIW, there are other functions in os that don't correspond >>> directly to their unix equivalents (e.g. Remove, ReadAt), >>> so i don't think it would matter so much if Chtime was similarly >>> different. it's not hard to look up. >>> >>> i don't think there are any other functions in os that modify >>> the environment that don't have an active verb in the name. >>> >>> >>> >>> On 5 May 2010 17:34, Russ Cox <rsc@golang.org> wrote: >>>> On Wed, May 5, 2010 at 08:21, roger peppe <rogpeppe@gmail.com> >>>> wrote: >>>>> i still think that Chtime or Chtimes would be a better name >>>>> for this call, given that the name Utime doesn't >>>>> correspond directly to the system call name. under >>>>> Windows, the name Utime would be even less appropriate, as the >>>>> the relevant call is SetFileInformationByHandle. >>>> >>>> utime does correspond directly to the original system call. >>>> the s variant was added to add sub-second precision. >>>> i agree that it's a clumsy name, but it's what people >>>> coming from unix (which is a lot of our developers) >>>> expect, and no one expects Chtime. >>>> (and SetFileInformationByHandle is right out.) >>>> >> >>
Sign in to reply to this message.
How about I name it Chtimes and mention utime/utimes in the docs for people doing quick searches? On Wed, May 5, 2010 at 10:35 AM, Rob 'Commander' Pike <r@google.com> wrote: > i can go either way but i must admit i like Chtime[s] better. > > -rob > > > On May 5, 2010, at 10:32 AM, roger peppe wrote: > > ah, maybe that's the case. my addled brain could >> only make "user", which naturally made no sense. >> in my defense, the man page (on os x at least) doesn't >> contain the word "update". >> >> On 5 May 2010 18:11, Brad Fitzpatrick <brad@danga.com> wrote: >> >>> Arguably, "U" is Update in the same way "Ch" is Change, if you're calling >>> "Ch" a verb. >>> On Wed, May 5, 2010 at 10:09 AM, roger peppe <rogpeppe@gmail.com> wrote: >>> >>>> >>>> i guess. >>>> >>>> FWIW, there are other functions in os that don't correspond >>>> directly to their unix equivalents (e.g. Remove, ReadAt), >>>> so i don't think it would matter so much if Chtime was similarly >>>> different. it's not hard to look up. >>>> >>>> i don't think there are any other functions in os that modify >>>> the environment that don't have an active verb in the name. >>>> >>>> >>>> >>>> On 5 May 2010 17:34, Russ Cox <rsc@golang.org> wrote: >>>> >>>>> On Wed, May 5, 2010 at 08:21, roger peppe <rogpeppe@gmail.com> wrote: >>>>> >>>>>> i still think that Chtime or Chtimes would be a better name >>>>>> for this call, given that the name Utime doesn't >>>>>> correspond directly to the system call name. under >>>>>> Windows, the name Utime would be even less appropriate, as the >>>>>> the relevant call is SetFileInformationByHandle. >>>>>> >>>>> >>>>> utime does correspond directly to the original system call. >>>>> the s variant was added to add sub-second precision. >>>>> i agree that it's a clumsy name, but it's what people >>>>> coming from unix (which is a lot of our developers) >>>>> expect, and no one expects Chtime. >>>>> (and SetFileInformationByHandle is right out.) >>>>> >>>>> >>> >>> >
Sign in to reply to this message.
Sounds good. On Wed, May 5, 2010 at 10:38, Brad Fitzpatrick <brad@danga.com> wrote: > How about I name it Chtimes and mention utime/utimes in the docs for people > doing quick searches? > > On Wed, May 5, 2010 at 10:35 AM, Rob 'Commander' Pike <r@google.com> wrote: >> >> i can go either way but i must admit i like Chtime[s] better. >> >> -rob >> >> On May 5, 2010, at 10:32 AM, roger peppe wrote: >> >>> ah, maybe that's the case. my addled brain could >>> only make "user", which naturally made no sense. >>> in my defense, the man page (on os x at least) doesn't >>> contain the word "update". >>> >>> On 5 May 2010 18:11, Brad Fitzpatrick <brad@danga.com> wrote: >>>> >>>> Arguably, "U" is Update in the same way "Ch" is Change, if you're >>>> calling >>>> "Ch" a verb. >>>> On Wed, May 5, 2010 at 10:09 AM, roger peppe <rogpeppe@gmail.com> wrote: >>>>> >>>>> i guess. >>>>> >>>>> FWIW, there are other functions in os that don't correspond >>>>> directly to their unix equivalents (e.g. Remove, ReadAt), >>>>> so i don't think it would matter so much if Chtime was similarly >>>>> different. it's not hard to look up. >>>>> >>>>> i don't think there are any other functions in os that modify >>>>> the environment that don't have an active verb in the name. >>>>> >>>>> >>>>> >>>>> On 5 May 2010 17:34, Russ Cox <rsc@golang.org> wrote: >>>>>> >>>>>> On Wed, May 5, 2010 at 08:21, roger peppe <rogpeppe@gmail.com> wrote: >>>>>>> >>>>>>> i still think that Chtime or Chtimes would be a better name >>>>>>> for this call, given that the name Utime doesn't >>>>>>> correspond directly to the system call name. under >>>>>>> Windows, the name Utime would be even less appropriate, as the >>>>>>> the relevant call is SetFileInformationByHandle. >>>>>> >>>>>> utime does correspond directly to the original system call. >>>>>> the s variant was added to add sub-second precision. >>>>>> i agree that it's a clumsy name, but it's what people >>>>>> coming from unix (which is a lot of our developers) >>>>>> expect, and no one expects Chtime. >>>>>> (and SetFileInformationByHandle is right out.) >>>>>> >>>> >>>> >> > >
Sign in to reply to this message.
Hello rsc, r (cc: golang-dev@googlegroups.com), Please take another look.
Sign in to reply to this message.
LGTM modulo commentary leaving for rsc http://codereview.appspot.com/1103041/diff/5002/23002 File src/pkg/os/file.go (right): http://codereview.appspot.com/1103041/diff/5002/23002#newcode414 src/pkg/os/file.go:414: // Note that Chtimes takes nanosecond granularity times but the s/Note that // but a rewrite is shorter anyway: The argument times are in nanoseconds, although the underlying... http://codereview.appspot.com/1103041/diff/5002/23002#newcode417 src/pkg/os/file.go:417: // subsequent Stat call. delete this last sentence please. it's jargony and redundant. http://codereview.appspot.com/1103041/diff/5002/23003 File src/pkg/os/os_test.go (right): http://codereview.appspot.com/1103041/diff/5002/23003#newcode498 src/pkg/os/os_test.go:498: t.Fatalf("stat %s: %s", Path, err) s/s/S/ http://codereview.appspot.com/1103041/diff/5002/23003#newcode505 src/pkg/os/os_test.go:505: t.Fatalf("chtimes %s: %s", Path, err) s/c/C/
Sign in to reply to this message.
Hello rsc, r (cc: golang-dev@googlegroups.com), Please take another look.
Sign in to reply to this message.
LGTM Thanks.
Sign in to reply to this message.
*** Submitted as http://code.google.com/p/go/source/detail?r=a79cd7447eaa *** os: add Chtimes function R=rsc, r CC=golang-dev http://codereview.appspot.com/1103041 Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.
|