Packages supported by TinyGo

The following table shows all Go standard library packages and whether they can be imported by TinyGo. If they can’t, you can click the ‘no’ link to jump to the explanation why the package cannot be compiled.

Note that the fact they can be imported, does not mean that all functions and types in the program can be used. For example, sometimes using some functions or types of the package will still trigger compiler errors.

Package Importable
archive/tar yes
archive/zip yes
bufio yes
bytes yes
compress/bzip2 yes
compress/flate yes
compress/gzip yes
compress/lzw yes
compress/zlib yes
container/heap yes
container/list yes
container/ring yes
context yes
crypto yes
crypto/aes yes
crypto/cipher yes
crypto/des yes
crypto/dsa yes
crypto/ecdsa yes
crypto/ed25519 no
crypto/elliptic yes
crypto/hmac yes
crypto/md5 yes
crypto/rand no
crypto/rc4 yes
crypto/rsa no
crypto/sha1 yes
crypto/sha256 yes
crypto/sha512 yes
crypto/subtle yes
crypto/tls no
crypto/x509 no
crypto/x509/pkix yes
database/sql yes
database/sql/driver yes
debug/dwarf yes
debug/elf yes
debug/gosym yes
debug/macho yes
debug/pe yes
debug/plan9obj yes
embed yes
encoding yes
encoding/ascii85 yes
encoding/asn1 yes
encoding/base32 yes
encoding/base64 yes
encoding/binary yes
encoding/csv yes
encoding/gob no
encoding/hex yes
encoding/json yes
encoding/pem yes
encoding/xml no
errors yes
expvar no
flag yes
fmt yes
go/ast yes
go/build no
go/build/constraint yes
go/constant yes
go/doc no
go/format no
go/importer no
go/parser no
go/printer yes
go/scanner yes
go/token yes
go/types no
hash yes
hash/adler32 yes
hash/crc32 yes
hash/crc64 yes
hash/fnv yes
hash/maphash yes
html yes
html/template no
image yes
image/color yes
image/color/palette yes
image/draw yes
image/gif yes
image/jpeg yes
image/png yes
index/suffixarray yes
io yes
io/fs yes
io/ioutil yes
log yes
log/syslog no
math yes
math/big yes
math/bits yes
math/cmplx yes
math/rand yes
mime yes
mime/multipart no
mime/quotedprintable yes
net no
net/http no
net/http/cgi no
net/http/cookiejar no
net/http/fcgi no
net/http/httptest no
net/http/httptrace no
net/http/httputil no
net/http/pprof no
net/mail no
net/rpc no
net/rpc/jsonrpc no
net/smtp no
net/textproto no
net/url yes
os yes
os/exec no
os/signal yes
os/user no
path yes
path/filepath yes
plugin yes
reflect yes
regexp yes
regexp/syntax yes
sort yes
strconv yes
strings yes
sync yes
sync/atomic yes
syscall yes
syscall/js yes
testing yes
testing/fstest yes
testing/iotest yes
testing/quick no
text/scanner yes
text/tabwriter yes
text/template no
text/template/parse yes
time yes
time/tzdata yes
unicode yes
unicode/utf16 yes
unicode/utf8 yes
unsafe yes

crypto/ed25519

This package cannot be imported because the following dependencies cannot be compiled:

crypto/rand

The compiler gave the following error when this package was imported:

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x4c3675e]

runtime stack:
runtime.throw(0x50dc149, 0x2a)
	/home/ron/.gvm/gos/go1.16.3/src/runtime/panic.go:1117 +0x72
runtime.sigpanic()
	/home/ron/.gvm/gos/go1.16.3/src/runtime/signal_unix.go:718 +0x2e5

goroutine 21 [syscall]:
runtime.cgocall(0xdd6800, 0xc003d939c0, 0xc0038589a0)
	/home/ron/.gvm/gos/go1.16.3/src/runtime/cgocall.go:154 +0x5b fp=0xc003d93990 sp=0xc003d93958 pc=0xa7db3b
tinygo.org/x/go-llvm._Cfunc_LLVMVerifyModule(0x7f434801c7f0, 0xc000000001, 0xc0038589a0, 0x0)
	_cgo_gotypes.go:9591 +0x48 fp=0xc003d939c0 sp=0xc003d93990 pc=0xcd4168
tinygo.org/x/go-llvm.VerifyModule.func1(0x7f434801c7f0, 0xc000000001, 0xc0038589a0, 0x7f4349080d58)
[...more lines following...]

crypto/rsa

This package cannot be imported because the following dependencies cannot be compiled:

crypto/tls

This package cannot be imported because the following dependencies cannot be compiled:

crypto/x509

This package cannot be imported because the following dependencies cannot be compiled:

encoding/gob

The compiler gave the following error when this package was imported:

# encoding/gob
/home/ron/.gvm/gos/go1.16.3/src/encoding/gob/decode.go:562:21: MakeMapWithSize not declared by package reflect
/home/ron/.gvm/gos/go1.16.3/src/encoding/gob/decode.go:1118:30: srt.FieldByName undefined (type reflect.Type has no field or method FieldByName)
/home/ron/.gvm/gos/go1.16.3/src/encoding/gob/encode.go:643:70: f.Index undefined (type reflect.StructField has no field or method Index)
/home/ron/.gvm/gos/go1.16.3/src/encoding/gob/type.go:867:9: rt.PkgPath undefined (type reflect.Type has no field or method PkgPath)
/home/ron/.gvm/gos/go1.16.3/src/encoding/gob/type.go:870:21: rt.PkgPath undefined (type reflect.Type has no field or method PkgPath)

encoding/xml

The compiler gave the following error when this package was imported:

# encoding/xml
/home/ron/.gvm/gos/go1.16.3/src/encoding/xml/typeinfo.go:114:29: f.Index undefined (type *reflect.StructField has no field or method Index)
/home/ron/.gvm/gos/go1.16.3/src/encoding/xml/typeinfo.go:318:14: typ.FieldByIndex undefined (type reflect.Type has no field or method FieldByIndex)
/home/ron/.gvm/gos/go1.16.3/src/encoding/xml/typeinfo.go:319:14: typ.FieldByIndex undefined (type reflect.Type has no field or method FieldByIndex)

expvar

This package cannot be imported because the following dependencies cannot be compiled:

go/build

This package cannot be imported because the following dependencies cannot be compiled:

go/doc

This package cannot be imported because the following dependencies cannot be compiled:

go/format

This package cannot be imported because the following dependencies cannot be compiled:

go/importer

This package cannot be imported because the following dependencies cannot be compiled:

go/parser

The compiler gave the following error when this package was imported:

# go/parser
/home/ron/.gvm/gos/go1.16.3/src/go/parser/interface.go:136:18: ReadDir not declared by package os

go/types

This package cannot be imported because the following dependencies cannot be compiled:

html/template

This package cannot be imported because the following dependencies cannot be compiled:

log/syslog

This package cannot be imported because the following dependencies cannot be compiled:

mime/multipart

This package cannot be imported because the following dependencies cannot be compiled:

net

The compiler gave the following error when this package was imported:

# net
/home/ron/.gvm/gos/go1.16.3/src/net/pipe.go:156:16: ErrDeadlineExceeded not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/net/pipe.go:169:16: ErrDeadlineExceeded not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/net/pipe.go:188:16: ErrDeadlineExceeded not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/net/pipe.go:204:17: ErrDeadlineExceeded not declared by package os

net/http

This package cannot be imported because the following dependencies cannot be compiled:

net/http/cgi

This package cannot be imported because the following dependencies cannot be compiled:

net/http/cookiejar

This package cannot be imported because the following dependencies cannot be compiled:

net/http/fcgi

This package cannot be imported because the following dependencies cannot be compiled:

net/http/httptest

This package cannot be imported because the following dependencies cannot be compiled:

net/http/httptrace

This package cannot be imported because the following dependencies cannot be compiled:

net/http/httputil

This package cannot be imported because the following dependencies cannot be compiled:

net/http/pprof

This package cannot be imported because the following dependencies cannot be compiled:

net/mail

This package cannot be imported because the following dependencies cannot be compiled:

net/rpc

This package cannot be imported because the following dependencies cannot be compiled:

net/rpc/jsonrpc

This package cannot be imported because the following dependencies cannot be compiled:

net/smtp

This package cannot be imported because the following dependencies cannot be compiled:

net/textproto

This package cannot be imported because the following dependencies cannot be compiled:

os/exec

The compiler gave the following error when this package was imported:

# os/exec
/home/ron/.gvm/gos/go1.16.3/src/os/exec/exec.go:130:14: Process not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/os/exec/exec.go:134:19: ProcessState not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/os/exec/exec.go:462:6: ProcessState not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/os/exec/exec.go:246:23: DevNull not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/os/exec/exec.go:258:20: Pipe not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/os/exec/exec.go:291:27: DevNull not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/os/exec/exec.go:303:20: Pipe not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/os/exec/exec.go:422:22: StartProcess not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/os/exec/exec.go:422:57: ProcAttr not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/os/exec/exec.go:584:20: Pipe not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/os/exec/exec.go:626:20: Pipe not declared by package os
/home/ron/.gvm/gos/go1.16.3/src/os/exec/exec.go:651:20: Pipe not declared by package os

os/user

The compiler gave the following error when this package was imported:

# os/user
/home/ron/.gvm/gos/go1.16.3/src/os/user/lookup.go:15:41: undeclared name: current
/home/ron/.gvm/gos/go1.16.3/src/os/user/lookup.go:36:9: undeclared name: lookupUser
/home/ron/.gvm/gos/go1.16.3/src/os/user/lookup.go:45:9: undeclared name: lookupUserId
/home/ron/.gvm/gos/go1.16.3/src/os/user/lookup.go:51:9: undeclared name: lookupGroup
/home/ron/.gvm/gos/go1.16.3/src/os/user/lookup.go:57:9: undeclared name: lookupGroupId
/home/ron/.gvm/gos/go1.16.3/src/os/user/lookup.go:62:9: undeclared name: listGroups

testing/quick

The compiler gave the following error when this package was imported:

# testing/quick
/home/ron/.gvm/gos/go1.16.3/src/testing/quick/quick.go:273:11: fType.NumOut undefined (type reflect.Type has no field or method NumOut)
/home/ron/.gvm/gos/go1.16.3/src/testing/quick/quick.go:276:11: fType.Out undefined (type reflect.Type has no field or method Out)
/home/ron/.gvm/gos/go1.16.3/src/testing/quick/quick.go:280:43: fType.NumIn undefined (type reflect.Type has no field or method NumIn)
/home/ron/.gvm/gos/go1.16.3/src/testing/quick/quick.go:290:12: fVal.Call undefined (type reflect.Value has no field or method Call)
/home/ron/.gvm/gos/go1.16.3/src/testing/quick/quick.go:320:43: xType.NumIn undefined (type reflect.Type has no field or method NumIn)
/home/ron/.gvm/gos/go1.16.3/src/testing/quick/quick.go:330:26: x.Call undefined (type reflect.Value has no field or method Call)
/home/ron/.gvm/gos/go1.16.3/src/testing/quick/quick.go:331:26: y.Call undefined (type reflect.Value has no field or method Call)
/home/ron/.gvm/gos/go1.16.3/src/testing/quick/quick.go:351:25: f.In undefined (type reflect.Type has no field or method In)
/home/ron/.gvm/gos/go1.16.3/src/testing/quick/quick.go:353:95: f.In undefined (type reflect.Type has no field or method In)

text/template

The compiler gave the following error when this package was imported:

# text/template
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:376:17: val.Type().ChanDir undefined (type reflect.Type has no field or method ChanDir)
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:376:38: SendDir not declared by package reflect
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:382:20: val.Recv undefined (type reflect.Value has no field or method Recv)
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:608:19: ptr.MethodByName undefined (type reflect.Value has no field or method MethodByName)
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:615:33: receiver.Type().FieldByName undefined (type reflect.Type has no field or method FieldByName)
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:650:21: etyp.FieldByName undefined (type reflect.Type has no field or method FieldByName)
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:683:9: typ.IsVariadic undefined (type reflect.Type has no field or method IsVariadic)
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:684:18: typ.NumIn undefined (type reflect.Type has no field or method NumIn)
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:686:79: typ.NumIn undefined (type reflect.Type has no field or method NumIn)
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:688:25: typ.NumIn undefined (type reflect.Type has no field or method NumIn)
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:689:69: typ.NumIn undefined (type reflect.Type has no field or method NumIn)
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:693:71: typ.NumOut undefined (type reflect.Type has no field or method NumOut)
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:700:32: typ.In undefined (type reflect.Type has no field or method In)
/home/ron/.gvm/gos/go1.16.3/src/text/template/exec.go:703:9: typ.IsVariadic undefined (type reflect.Type has no field or method IsVariadic)
[...more lines following...]