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 no
archive/zip no
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 no
crypto/ed25519 yes
crypto/elliptic yes
crypto/hmac yes
crypto/md5 yes
crypto/rand yes
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 no
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
encoding yes
encoding/ascii85 yes
encoding/asn1 no
encoding/base32 yes
encoding/base64 yes
encoding/binary yes
encoding/csv yes
encoding/gob no
encoding/hex yes
encoding/json no
encoding/pem yes
encoding/xml no
errors yes
expvar no
flag yes
fmt yes
go/ast yes
go/build no
go/constant yes
go/doc no
go/format yes
go/importer no
go/parser yes
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/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/iotest no
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

archive/tar

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

# archive/tar
/home/ron/.gvm/gos/go1.15/src/archive/tar/common.go:554:32: os.FileMode(fi.h.Mode).Perm undefined (type os.FileMode has no field or method Perm)
/home/ron/.gvm/gos/go1.15/src/archive/tar/common.go:636:15: fi.ModTime undefined (type os.FileInfo has no field or method ModTime)
/home/ron/.gvm/gos/go1.15/src/archive/tar/common.go:637:21: fm.Perm undefined (type os.FileMode has no field or method Perm)
/home/ron/.gvm/gos/go1.15/src/archive/tar/common.go:640:10: fm.IsRegular undefined (type os.FileMode has no field or method IsRegular)

archive/zip

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

# archive/zip
/home/ron/.gvm/gos/go1.15/src/archive/zip/struct.go:180:19: fi.ModTime undefined (type os.FileInfo has no field or method ModTime)

crypto/ecdsa

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

# encoding/asn1
encoding/asn1/: interp: unknown GEP

crypto/rsa

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

# crypto/rsa
/home/ron/.gvm/gos/go1.15/src/math/big/nat.go:74:11: interp: unknown GEP

traceback:
/home/ron/.gvm/gos/go1.15/src/math/big/nat.go:84:19:
  %9 = call { i32*, i32, i32 } @"(math/big.nat).setWord"(i32* %6, i32 %7, i32 %8, i32 %3, i8* undef, i8* undef), !dbg !1749
/home/ron/.gvm/gos/go1.15/src/math/big/int.go:55:25:
  %17 = call { i32*, i32, i32 } @"(math/big.nat).setUint64"(i32* %14, i32 %15, i32 %16, i64 %2, i8* undef, i8* undef), !dbg !1755
/home/ron/.gvm/gos/go1.15/src/math/big/int.go:69:26:
  %2 = call %"math/big.Int"* @"(*math/big.Int).SetInt64"(%"math/big.Int"* %0, i64 %x, i8* undef, i8* undef), !dbg !1739
crypto/rsa/:38:25:
  %288 = call %"math/big.Int"* @"math/big.NewInt"(i64 0, i8* undef, i8* undef), !dbg !1867

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:

crypto/x509/pkix

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

encoding/asn1

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

# encoding/asn1
encoding/asn1/: interp: unknown GEP

encoding/gob

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

# encoding/gob
/home/ron/.gvm/gos/go1.15/src/encoding/gob/decode.go:562:21: MakeMapWithSize not declared by package reflect
/home/ron/.gvm/gos/go1.15/src/encoding/gob/decode.go:948:22: PtrTo not declared by package reflect
/home/ron/.gvm/gos/go1.15/src/encoding/gob/decode.go:1118:30: srt.FieldByName undefined (type reflect.Type has no field or method FieldByName)
/home/ron/.gvm/gos/go1.15/src/encoding/gob/encode.go:603:16: PtrTo not declared by package reflect
/home/ron/.gvm/gos/go1.15/src/encoding/gob/encode.go:643:70: f.Index undefined (type reflect.StructField has no field or method Index)
/home/ron/.gvm/gos/go1.15/src/encoding/gob/type.go:119:12: cannot convert nil (untyped nil value) to reflect.Type
/home/ron/.gvm/gos/go1.15/src/encoding/gob/type.go:142:14: PtrTo not declared by package reflect
/home/ron/.gvm/gos/go1.15/src/encoding/gob/type.go:867:9: rt.PkgPath undefined (type reflect.Type has no field or method PkgPath)
/home/ron/.gvm/gos/go1.15/src/encoding/gob/type.go:870:21: rt.PkgPath undefined (type reflect.Type has no field or method PkgPath)

encoding/json

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

# encoding/json
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:160:15: cannot convert nil (untyped nil value) to reflect.Type
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:232:26: cannot convert nil (untyped nil value) to reflect.Type
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:249:30: cannot convert nil (untyped nil value) to reflect.Type
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:515:8: v.NumMethod undefined (type reflect.Value has no field or method NumMethod)
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:552:7: v.SetLen undefined (type reflect.Value has no field or method SetLen)
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:589:6: v.SetLen undefined (type reflect.Value has no field or method SetLen)
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:620:40: v.NumMethod undefined (type reflect.Value has no field or method NumMethod)
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:641:16: PtrTo not declared by package reflect
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:776:17: PtrTo not declared by package reflect
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:921:9: v.NumMethod undefined (type reflect.Value has no field or method NumMethod)
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:950:6: v.SetBytes undefined (type reflect.Value has no field or method SetBytes)
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:957:9: v.NumMethod undefined (type reflect.Value has no field or method NumMethod)
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:990:9: v.NumMethod undefined (type reflect.Value has no field or method NumMethod)
/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:1014:23: v.OverflowFloat undefined (type reflect.Value has no field or method OverflowFloat)
[...more lines following...]

encoding/xml

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

# encoding/xml
/home/ron/.gvm/gos/go1.15/src/encoding/xml/read.go:286:8: val.SetLen undefined (type reflect.Value has no field or method SetLen)
/home/ron/.gvm/gos/go1.15/src/encoding/xml/read.go:402:6: v.SetLen undefined (type reflect.Value has no field or method SetLen)
/home/ron/.gvm/gos/go1.15/src/encoding/xml/read.go:665:7: dst.SetBytes undefined (type reflect.Value has no field or method SetBytes)
/home/ron/.gvm/gos/go1.15/src/encoding/xml/typeinfo.go:114:29: f.Index undefined (type *reflect.StructField has no field or method Index)
/home/ron/.gvm/gos/go1.15/src/encoding/xml/typeinfo.go:318:14: typ.FieldByIndex undefined (type reflect.Type has no field or method FieldByIndex)
/home/ron/.gvm/gos/go1.15/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/importer

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

go/types

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

panic: interp: load from a bitcast

goroutine 1 [running]:
github.com/tinygo-org/tinygo/interp.(*LocalValue).Load(0xc00b2a3010, 0xc00b2a3010)
    /home/ron/Development/tinygo/tinygo/interp/values.go:61 +0x226
github.com/tinygo-org/tinygo/interp.(*LocalValue).Load(0xc00b2a3000, 0x7f040000001d)
    /home/ron/Development/tinygo/tinygo/interp/values.go:58 +0x135
github.com/tinygo-org/tinygo/interp.(*frame).evalBasicBlock(0xc0092349b0, 0x7f0434e8cd00, 0x7f0434e8c870, 0xc00b2a4970, 0xc, 0x0, 0x0, 0xc00b205600, 0x1, 0x1, ...)
    /home/ron/Development/tinygo/tinygo/interp/frame.go:98 +0xd785
github.com/tinygo-org/tinygo/interp.(*evalPackage).function(0xc0092374e0, 0x7f0428022488, 0xc007db5800, 0x9, 0x10, 0xc00b2a4970, 0xc, 0x10, 0xc00b2a2560, 0x0)
    /home/ron/Development/tinygo/tinygo/interp/interp.go:113 +0x249
github.com/tinygo-org/tinygo/interp.(*frame).evalBasicBlock(0xc009235768, 0x7f0434ef43d0, 0x7f0434ef4040, 0xc00b29b9b8, 0x8, 0x0, 0x0, 0xc00b205458, 0x1, 0x1, ...)
    /home/ron/Development/tinygo/tinygo/interp/frame.go:570 +0x6c7e
github.com/tinygo-org/tinygo/interp.(*evalPackage).function(0xc0092374e0, 0x7f0428023338, 0xc007f17880, 0x7, 0x8, 0xc00b29b9b8, 0x8, 0x8, 0xc00b289c40, 0x0)
    /home/ron/Development/tinygo/tinygo/interp/interp.go:113 +0x249
[...more lines following...]

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.15/src/net/parse.go:80:12: st.ModTime undefined (type os.FileInfo has no field or method ModTime)
/home/ron/.gvm/gos/go1.15/src/net/pipe.go:156:16: ErrDeadlineExceeded not declared by package os
/home/ron/.gvm/gos/go1.15/src/net/pipe.go:169:16: ErrDeadlineExceeded not declared by package os
/home/ron/.gvm/gos/go1.15/src/net/pipe.go:188:16: ErrDeadlineExceeded not declared by package os
/home/ron/.gvm/gos/go1.15/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.15/src/os/exec/exec.go:130:14: Process not declared by package os
/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:134:19: ProcessState not declared by package os
/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:462:6: ProcessState not declared by package os
/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:246:23: DevNull not declared by package os
/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:258:20: Pipe not declared by package os
/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:291:27: DevNull not declared by package os
/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:303:20: Pipe not declared by package os
/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:422:22: StartProcess not declared by package os
/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:422:57: ProcAttr not declared by package os
/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:584:20: Pipe not declared by package os
/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:626:20: Pipe not declared by package os
/home/ron/.gvm/gos/go1.15/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.15/src/os/user/lookup.go:15:41: undeclared name: current
/home/ron/.gvm/gos/go1.15/src/os/user/lookup.go:36:9: undeclared name: lookupUser
/home/ron/.gvm/gos/go1.15/src/os/user/lookup.go:45:9: undeclared name: lookupUserId
/home/ron/.gvm/gos/go1.15/src/os/user/lookup.go:51:9: undeclared name: lookupGroup
/home/ron/.gvm/gos/go1.15/src/os/user/lookup.go:57:9: undeclared name: lookupGroupId
/home/ron/.gvm/gos/go1.15/src/os/user/lookup.go:62:9: undeclared name: listGroups

testing/iotest

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

# testing/iotest
../../../../../tmp/tinygo-test.go:2:8: cannot find package "testing/iotest" in any of:
    /home/ron/.cache/tinygo/goroot-go1.15-7afa574ac889bbfe1ced1698a5a8cef44acba21596cd94a64313a8cd1019f95d/src/testing/iotest (from $GOROOT)
    /home/ron/.gvm/pkgsets/go1.15/global/src/testing/iotest (from $GOPATH)

testing/quick

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

# testing/quick
../../../../../tmp/tinygo-test.go:2:8: cannot find package "testing/quick" in any of:
    /home/ron/.cache/tinygo/goroot-go1.15-7afa574ac889bbfe1ced1698a5a8cef44acba21596cd94a64313a8cd1019f95d/src/testing/quick (from $GOROOT)
    /home/ron/.gvm/pkgsets/go1.15/global/src/testing/quick (from $GOPATH)

text/template

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

# text/template
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:377:20: val.Recv undefined (type reflect.Value has no field or method Recv)
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:541:25: cannot convert nil (untyped nil value) to reflect.Type
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:603:19: ptr.MethodByName undefined (type reflect.Value has no field or method MethodByName)
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:610:33: receiver.Type().FieldByName undefined (type reflect.Type has no field or method FieldByName)
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:645:21: etyp.FieldByName undefined (type reflect.Type has no field or method FieldByName)
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:678:9: typ.IsVariadic undefined (type reflect.Type has no field or method IsVariadic)
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:679:18: typ.NumIn undefined (type reflect.Type has no field or method NumIn)
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:681:79: typ.NumIn undefined (type reflect.Type has no field or method NumIn)
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:683:25: typ.NumIn undefined (type reflect.Type has no field or method NumIn)
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:684:69: typ.NumIn undefined (type reflect.Type has no field or method NumIn)
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:688:71: typ.NumOut undefined (type reflect.Type has no field or method NumOut)
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:695:32: typ.In undefined (type reflect.Type has no field or method In)
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:698:9: typ.IsVariadic undefined (type reflect.Type has no field or method IsVariadic)
/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:699:18: typ.In undefined (type reflect.Type has no field or method In)
[...more lines following...]