mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 22:43:40 +00:00
wasm-unknown: make sure the os package can be imported
See: https://github.com/tinygo-org/tinygo/issues/4314 The os package isn't particularly useful on wasm-unknown, but just like on baremetal systems it's imported by a lot of packages so it should at least be possible to import this package.
This commit is contained in:
@@ -3,6 +3,10 @@
|
|||||||
// tinygo build -size short -o hello-unknown.wasm -target wasm-unknown -gc=leaking -no-debug ./src/examples/hello-wasm-unknown/
|
// tinygo build -size short -o hello-unknown.wasm -target wasm-unknown -gc=leaking -no-debug ./src/examples/hello-wasm-unknown/
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
// Smoke test: make sure the fmt package can be imported (even if it isn't
|
||||||
|
// really useful for wasm-unknown).
|
||||||
|
import _ "os"
|
||||||
|
|
||||||
var x int32
|
var x int32
|
||||||
|
|
||||||
//go:wasmimport hosted echo_i32
|
//go:wasmimport hosted echo_i32
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
//go:build baremetal || js || windows
|
//go:build baremetal || js || windows || wasm_unknown
|
||||||
|
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build linux && !baremetal && !wasip1
|
//go:build linux && !baremetal && !wasip1 && !wasm_unknown
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build !baremetal && !js && !wasip1
|
//go:build !baremetal && !js && !wasip1 && !wasm_unknown
|
||||||
|
|
||||||
// Copyright 2020 The Go Authors. All rights reserved.
|
// Copyright 2020 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build !baremetal && !js
|
//go:build !baremetal && !js && !wasm_unknown
|
||||||
|
|
||||||
// Portions copyright 2009 The Go Authors. All rights reserved.
|
// Portions copyright 2009 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build baremetal || (wasm && !wasip1)
|
//go:build baremetal || (tinygo.wasm && !wasip1)
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
//go:build darwin || (linux && !baremetal) || wasip1
|
//go:build darwin || (linux && !baremetal && !wasm_unknown) || wasip1
|
||||||
|
|
||||||
// target wasi sets GOOS=linux and thus the +linux build tag,
|
// target wasi sets GOOS=linux and thus the +linux build tag,
|
||||||
// even though it doesn't show up in "tinygo info target -wasi"
|
// even though it doesn't show up in "tinygo info target -wasi"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build !baremetal && !js && !wasip1
|
//go:build !baremetal && !js && !wasip1 && !wasm_unknown
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build baremetal || js || wasi || wasip1
|
//go:build baremetal || js || wasi || wasip1 || wasm_unknown
|
||||||
|
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build (linux && !baremetal) || wasip1
|
//go:build (linux && !baremetal && !wasm_unknown) || wasip1
|
||||||
|
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build baremetal || (wasm && !wasip1)
|
//go:build baremetal || (tinygo.wasm && !wasip1)
|
||||||
|
|
||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
// Copyright 2016 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
//go:build darwin || (linux && !baremetal) || wasip1
|
//go:build darwin || (linux && !baremetal && !wasm_unknown) || wasip1
|
||||||
|
|
||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
// Copyright 2016 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build !baremetal && !js
|
//go:build !baremetal && !js && !wasm_unknown
|
||||||
|
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build darwin || (linux && !baremetal) || wasip1
|
//go:build darwin || (linux && !baremetal && !wasm_unknown) || wasip1
|
||||||
|
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build baremetal || js
|
//go:build baremetal || js || wasm_unknown
|
||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ func init() {
|
|||||||
__wasm_call_ctors()
|
__wasm_call_ctors()
|
||||||
}
|
}
|
||||||
|
|
||||||
var args []string
|
|
||||||
|
|
||||||
func ticksToNanoseconds(ticks timeUnit) int64 {
|
func ticksToNanoseconds(ticks timeUnit) int64 {
|
||||||
return int64(ticks)
|
return int64(ticks)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user