[go] os: deprecate SEEK_SET and friends

378 views
Skip to first unread message

Joe Tsai (Gerrit)

unread,
Apr 5, 2016, 2:30:55 PM4/5/16
to Ian Lance Taylor, golang-co...@googlegroups.com
Joe Tsai uploaded a change:
https://go-review.googlesource.com/21540

os: deprecate SEEK_SET and friends

CL/19862 introduced the same set of constants to the io package. We should
steer users away from the OS.SEEK* versions and towards the io.Seek*
versions.

Updates #19862

Change-Id: I96ec5be3ec3439e1295c937159dadaf1ebfb2737
---
M src/os/file.go
1 file changed, 2 insertions(+), 0 deletions(-)



diff --git a/src/os/file.go b/src/os/file.go
index 6b1ecbc..aa29e08 100644
--- a/src/os/file.go
+++ b/src/os/file.go
@@ -66,6 +66,8 @@
)

// Seek whence values.
+//
+// Deprecated: Please use io.SeekStart and friends.
const (
SEEK_SET int = 0 // seek relative to the origin of the file
SEEK_CUR int = 1 // seek relative to the current offset

--
https://go-review.googlesource.com/21540

Brad Fitzpatrick (Gerrit)

unread,
Apr 5, 2016, 2:32:54 PM4/5/16
to Joe Tsai, Brad Fitzpatrick, golang-co...@googlegroups.com
Brad Fitzpatrick has posted comments on this change.

os: deprecate SEEK_SET and friends

Patch Set 1:

(1 comment)

https://go-review.googlesource.com/#/c/21540/1/src/os/file.go
File src/os/file.go:

Line 70: // Deprecated: Please use io.SeekStart and friends.
drop Please, and drop "and friends".

With the saved space, you can list the other two constants by name.


--
https://go-review.googlesource.com/21540
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-HasComments: Yes

Joe Tsai (Gerrit)

unread,
Apr 5, 2016, 3:56:40 PM4/5/16
to Brad Fitzpatrick, golang-co...@googlegroups.com
Joe Tsai uploaded a new patch set:
https://go-review.googlesource.com/21540

os: deprecate SEEK_SET and friends

CL/19862 introduced the same set of constants to the io package. We should
steer users away from the OS.SEEK* versions and towards the io.Seek*
versions.

Updates #19862

Change-Id: I96ec5be3ec3439e1295c937159dadaf1ebfb2737
---
M src/os/file.go
1 file changed, 2 insertions(+), 0 deletions(-)


Joe Tsai (Gerrit)

unread,
Apr 5, 2016, 3:57:40 PM4/5/16
to Brad Fitzpatrick, golang-co...@googlegroups.com
Joe Tsai uploaded a new patch set:
https://go-review.googlesource.com/21540

os: deprecate os.SEEK_SET, os.SEEK_CUR, and os.SEEK_END

CL/19862 introduced the same set of constants to the io package.
We should steer users away from the os.SEEK* versions and towards
the io.Seek* versions.

Updates #19862

Change-Id: I96ec5be3ec3439e1295c937159dadaf1ebfb2737
---
M src/os/file.go
1 file changed, 2 insertions(+), 0 deletions(-)


Joe Tsai (Gerrit)

unread,
Apr 5, 2016, 3:58:09 PM4/5/16
to Brad Fitzpatrick, golang-co...@googlegroups.com
Joe Tsai has posted comments on this change.

os: deprecate os.SEEK_SET, os.SEEK_CUR, and os.SEEK_END

Patch Set 1:

(1 comment)

https://go-review.googlesource.com/#/c/21540/1/src/os/file.go
File src/os/file.go:

Line 70: // Deprecated: Please use io.SeekStart and friends.
> drop Please, and drop "and friends".
Done


--
https://go-review.googlesource.com/21540
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Joe Tsai <joe...@digital-static.net>
Gerrit-HasComments: Yes

Joe Tsai (Gerrit)

unread,
Apr 5, 2016, 3:59:06 PM4/5/16
to Brad Fitzpatrick, golang-co...@googlegroups.com
Joe Tsai uploaded a new patch set:
https://go-review.googlesource.com/21540

os: deprecate os.SEEK_SET, os.SEEK_CUR, and os.SEEK_END

CL/19862 introduced the same set of constants to the io package.
We should steer users away from the os.SEEK* versions and towards
the io.Seek* versions.

Updates #6885

Change-Id: I96ec5be3ec3439e1295c937159dadaf1ebfb2737
---
M src/os/file.go
1 file changed, 2 insertions(+), 0 deletions(-)


Brad Fitzpatrick (Gerrit)

unread,
Apr 5, 2016, 3:59:42 PM4/5/16
to Joe Tsai, Brad Fitzpatrick, golang-co...@googlegroups.com
Brad Fitzpatrick has posted comments on this change.

os: deprecate os.SEEK_SET, os.SEEK_CUR, and os.SEEK_END

Patch Set 4: Code-Review+2

Hard to get excited about this, but sure.

--
https://go-review.googlesource.com/21540
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Joe Tsai <joe...@digital-static.net>
Gerrit-HasComments: No

Brad Fitzpatrick (Gerrit)

unread,
Apr 5, 2016, 3:59:53 PM4/5/16
to Brad Fitzpatrick, Joe Tsai, golang-...@googlegroups.com, golang-co...@googlegroups.com
Brad Fitzpatrick has submitted this change and it was merged.

os: deprecate os.SEEK_SET, os.SEEK_CUR, and os.SEEK_END

CL/19862 introduced the same set of constants to the io package.
We should steer users away from the os.SEEK* versions and towards
the io.Seek* versions.

Updates #6885

Change-Id: I96ec5be3ec3439e1295c937159dadaf1ebfb2737
Reviewed-on: https://go-review.googlesource.com/21540
Reviewed-by: Brad Fitzpatrick <brad...@golang.org>
---
M src/os/file.go
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
Brad Fitzpatrick: Looks good to me, approved

Ian Lance Taylor (Gerrit)

unread,
Apr 5, 2016, 8:46:45 PM4/5/16
to Brad Fitzpatrick, Joe Tsai, golang-co...@googlegroups.com
Ian Lance Taylor has posted comments on this change.

os: deprecate os.SEEK_SET, os.SEEK_CUR, and os.SEEK_END

Patch Set 5:

I don't feel strongly about this at all, but I'm not sure how it helps to
add a "deprecated" comment here. We're never going to get rid of these
constants. They still work just as well as they ever did. It's not like a
function that we want the programmer to replace with some other function
that works differently (better) in some way. These constants work exactly
the same way.

--
https://go-review.googlesource.com/21540
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Joe Tsai <joe...@digital-static.net>
Gerrit-HasComments: No

Brad Fitzpatrick (Gerrit)

unread,
Apr 5, 2016, 10:25:26 PM4/5/16
to Brad Fitzpatrick, Joe Tsai, golang-co...@googlegroups.com
Brad Fitzpatrick has posted comments on this change.

os: deprecate os.SEEK_SET, os.SEEK_CUR, and os.SEEK_END

Patch Set 5:

I had the same thoughts and was going to reply similarly, but they work
better in that they spread best practice style-wise better if you use the
better-named constants.
Reply all
Reply to author
Forward
0 new messages