|
|
Descriptionos: no /tmp on android
Patch Set 1 #Patch Set 2 : diff -r 903812b06e87 https://code.google.com/p/go #Patch Set 3 : diff -r 903812b06e87 https://code.google.com/p/go #Patch Set 4 : diff -r 903812b06e87 https://code.google.com/p/go #Patch Set 5 : diff -r 903812b06e87 https://code.google.com/p/go #Patch Set 6 : diff -r 903812b06e87 https://code.google.com/p/go #MessagesTotal messages: 14
Hello golang-codereviews@googlegroups.com (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
Sign in to reply to this message.
do you expect to have other differences between linux and android in the os package? if yes, then i'd suggest we add two files: //android.go const isAndroid = true // nonandroid.go // +build !android const isAndroid = false and use isAndroid instead. i don't like adding more init()s to core packages like os, and besides using a constant boolean makes the compiler eliminate unused branches, so it's practically free in terms of run time.
Sign in to reply to this message.
as long as we are adding two files, how about this? On Wed, Jul 9, 2014 at 1:36 PM, <minux@golang.org> wrote: > do you expect to have other differences between linux and android > in the os package? > > if yes, then i'd suggest we add two files: > > //android.go > const isAndroid = true > > // nonandroid.go > // +build !android > const isAndroid = false > > and use isAndroid instead. > > i don't like adding more init()s to core packages like os, and besides > using a constant boolean makes the compiler eliminate unused branches, > so it's practically free in terms of run time. > > https://codereview.appspot.com/104650043/
Sign in to reply to this message.
I'd rather not duplicate a public function, because that means duplicating its public docs, which is the more offensive part. I like the isAndroid const idea. The compiler will remove dead code, and it keeps the code easier to find and together with related stuff.
Sign in to reply to this message.
On 2014/07/09 17:43:47, crawshaw wrote: > as long as we are adding two files, how about this? i still think the isAndroid approach is better, as the tempdir_$GOOS.go approach duplicates too much. If this is the only code change needed for android, then LGTM.
Sign in to reply to this message.
my thinking was that there are already three copies of this function, in file_{plan9,windows,unix}.go. so introducing isAndroid would add another mechanism. i don't have any other changes to package os planned, but future is unclear. On Wed, Jul 9, 2014 at 1:49 PM, <minux@golang.org> wrote: > On 2014/07/09 17:43:47, crawshaw wrote: >> >> as long as we are adding two files, how about this? > > i still think the isAndroid approach is better, as the tempdir_$GOOS.go > approach duplicates too much. > > If this is the only code change needed for android, then LGTM. > > https://codereview.appspot.com/104650043/
Sign in to reply to this message.
Why not just modify only file_unix.go in this CL and add a: if runtime.GOOS == "android" { dir = "/data/local/tmp" } else { dir = "/tmp" } The if will compile away anyway. On Wed, Jul 9, 2014 at 10:53 AM, David Crawshaw <crawshaw@golang.org> wrote: > my thinking was that there are already three copies of this function, > in file_{plan9,windows,unix}.go. so introducing isAndroid would add > another mechanism. > > i don't have any other changes to package os planned, but future is > unclear. > > On Wed, Jul 9, 2014 at 1:49 PM, <minux@golang.org> wrote: > > On 2014/07/09 17:43:47, crawshaw wrote: > >> > >> as long as we are adding two files, how about this? > > > > i still think the isAndroid approach is better, as the tempdir_$GOOS.go > > approach duplicates too much. > > > > If this is the only code change needed for android, then LGTM. > > > > https://codereview.appspot.com/104650043/ >
Sign in to reply to this message.
Nice. Done. On Wed, Jul 9, 2014 at 1:58 PM, Brad Fitzpatrick <bradfitz@golang.org> wrote: > Why not just modify only file_unix.go in this CL and add a: > > if runtime.GOOS == "android" { > dir = "/data/local/tmp" > } else { > dir = "/tmp" > } > > The if will compile away anyway. > > > > On Wed, Jul 9, 2014 at 10:53 AM, David Crawshaw <crawshaw@golang.org> wrote: >> >> my thinking was that there are already three copies of this function, >> in file_{plan9,windows,unix}.go. so introducing isAndroid would add >> another mechanism. >> >> i don't have any other changes to package os planned, but future is >> unclear. >> >> On Wed, Jul 9, 2014 at 1:49 PM, <minux@golang.org> wrote: >> > On 2014/07/09 17:43:47, crawshaw wrote: >> >> >> >> as long as we are adding two files, how about this? >> > >> > i still think the isAndroid approach is better, as the tempdir_$GOOS.go >> > approach duplicates too much. >> > >> > If this is the only code change needed for android, then LGTM. >> > >> > https://codereview.appspot.com/104650043/ > >
Sign in to reply to this message.
On Wed, Jul 9, 2014 at 1:58 PM, Brad Fitzpatrick <bradfitz@golang.org> wrote: > Why not just modify only file_unix.go in this CL and add a: > > if runtime.GOOS == "android" { > dir = "/data/local/tmp" > } else { > dir = "/tmp" > } > > The if will compile away anyway. > yeah, this is better for tmpdir.
Sign in to reply to this message.
LGTM.
Sign in to reply to this message.
LGTM
Sign in to reply to this message.
*** Submitted as https://code.google.com/p/go/source/detail?r=141e6dead8db *** os: no /tmp on android LGTM=minux, bradfitz R=golang-codereviews, minux, bradfitz CC=golang-codereviews https://codereview.appspot.com/104650043
Sign in to reply to this message.
Message was sent while issue was closed.
This CL appears to have broken the freebsd-amd64-race builder. See http://build.golang.org/log/5c62dd14f3ad1e3f6a3756684446df7cdae2fc5c
Sign in to reply to this message.
Nope. On Wed, Jul 9, 2014 at 2:24 PM, <gobot@golang.org> wrote: > This CL appears to have broken the freebsd-amd64-race builder. > See http://build.golang.org/log/5c62dd14f3ad1e3f6a3756684446df7cdae2fc5c > > https://codereview.appspot.com/104650043/
Sign in to reply to this message.
|