Skip to content

Use current working directory, or GOPHERJS_TEMPDIR variable for temp files #334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ dependencies:
test:
override:
- 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
- go test -v -race ./...
- GOPHERJS_TEMPDIR=/tmp go test -v -race ./...
9 changes: 7 additions & 2 deletions tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
)

var currentDirectory string
var temporaryDirectory string

func init() {
var err error
Expand All @@ -44,6 +45,10 @@ func init() {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
temporaryDirectory = os.Getenv("GOPHERJS_TEMPDIR")
if temporaryDirectory == "" {
temporaryDirectory = currentDirectory
}
}

func main() {
Expand Down Expand Up @@ -222,7 +227,7 @@ func main() {
return fmt.Errorf("gopherjs run: no go files listed")
}

tempfile, err := ioutil.TempFile("", filepath.Base(args[0])+".")
tempfile, err := ioutil.TempFile(temporaryDirectory, filepath.Base(args[0])+".")
if err != nil {
return err
}
Expand Down Expand Up @@ -356,7 +361,7 @@ func main() {
return err
}

tempfile, err := ioutil.TempFile("", "test.")
tempfile, err := ioutil.TempFile(temporaryDirectory, "test.")
if err != nil {
return err
}
Expand Down