Skip to content

Commit 45ccea9

Browse files
committed
Use current working directory, or GOPHERJS_TEMPDIR variable for temp files
1 parent 09f5ab3 commit 45ccea9

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

circle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ dependencies:
1313
test:
1414
override:
1515
- gopherjs test --short --minify github.com/gopherjs/gopherjs/tests github.com/gopherjs/gopherjs/tests/main github.com/gopherjs/gopherjs/js archive/tar archive/zip bufio bytes compress/bzip2 compress/flate compress/gzip compress/lzw compress/zlib container/heap container/list container/ring crypto/aes crypto/cipher crypto/des crypto/dsa crypto/ecdsa crypto/elliptic crypto/hmac crypto/md5 crypto/rand crypto/rc4 crypto/rsa crypto/sha1 crypto/sha256 crypto/sha512 crypto/subtle crypto/x509 database/sql database/sql/driver debug/dwarf debug/elf debug/gosym debug/macho debug/pe encoding/ascii85 encoding/asn1 encoding/base32 encoding/base64 encoding/binary encoding/csv encoding/gob encoding/hex encoding/json encoding/pem encoding/xml errors expvar flag fmt go/ast go/constant go/doc go/format go/parser go/printer go/scanner go/token hash/adler32 hash/crc32 hash/crc64 hash/fnv html html/template image image/color image/draw image/gif image/jpeg image/png index/suffixarray io io/ioutil math math/big math/cmplx math/rand mime mime/multipart mime/quotedprintable net/http/cookiejar net/http/fcgi net/mail net/rpc/jsonrpc net/textproto net/url path path/filepath reflect regexp regexp/syntax sort strconv strings sync sync/atomic testing/quick text/scanner text/tabwriter text/template text/template/parse time unicode unicode/utf16 unicode/utf8
16-
- go test -v -race ./...
16+
- GOPHERJS_TEMPDIR=/tmp go test -v -race ./...

tool.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
)
3232

3333
var currentDirectory string
34+
var temporaryDirectory string
3435

3536
func init() {
3637
var err error
@@ -44,6 +45,10 @@ func init() {
4445
fmt.Fprintln(os.Stderr, err)
4546
os.Exit(1)
4647
}
48+
temporaryDirectory = os.Getenv("GOPHERJS_TEMPDIR")
49+
if len(temporaryDirectory) == 0 {
50+
temporaryDirectory = currentDirectory
51+
}
4752
}
4853

4954
func main() {
@@ -222,7 +227,7 @@ func main() {
222227
return fmt.Errorf("gopherjs run: no go files listed")
223228
}
224229

225-
tempfile, err := ioutil.TempFile("", filepath.Base(args[0])+".")
230+
tempfile, err := ioutil.TempFile(temporaryDirectory, filepath.Base(args[0])+".")
226231
if err != nil {
227232
return err
228233
}
@@ -356,7 +361,7 @@ func main() {
356361
return err
357362
}
358363

359-
tempfile, err := ioutil.TempFile("", "test.")
364+
tempfile, err := ioutil.TempFile(temporaryDirectory, "test.")
360365
if err != nil {
361366
return err
362367
}

0 commit comments

Comments
 (0)