Skip to content

GopherJS 1.8-wip: "warning: system calls not available" printed whenever "os" package imported. #583

Closed
@dmitshur

Description

@dmitshur

I've mentioned this in #552 (comment), but I've confirmed it happens in 1.8 only now.

I've investigated it and found the root cause.

image

It happens with GopherJS 1.8-wip only when "os" package is imported (not necessarily directly). That package is often imported by other packages, such as "net/http", or if you're getting os.Stdout, etc.

It happens because of Executable() addition to os package in Go 1.8.

As a result, os.Getwd() gets called as part of os package initialization:

var initCwd, initCwdErr = Getwd()

Source: https://github.com/golang/go/blob/09762ccff79ebf08839f8954ab99c17d41f071e2/src/os/executable_darwin.go#L9.

Calling os.Getwd() in browser ends up making a call to Syscall, which causes the warning to get printed to console (note that it's actually printed as an error to console).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions