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 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

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

traceback:
encoding/asn1/:
  %12 = getelementptr inbounds { %"encoding/asn1.BitString" }, { %"encoding/asn1.BitString" }* %11, i32 0, i32 0, !dbg !1934

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:74:11:
  %16 = getelementptr inbounds i32, i32* %4, i32 0, !dbg !1742
/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

traceback:
encoding/asn1/:
  %12 = getelementptr inbounds { %"encoding/asn1.BitString" }, { %"encoding/asn1.BitString" }* %11, i32 0, i32 0, !dbg !1837

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:

# go/types
/home/ron/Development/tinygo/tinygo/src/runtime/hashmap.go:203:21: interp: load from a bitcast

traceback:
/home/ron/Development/tinygo/tinygo/src/runtime/hashmap.go:203:21:
  %83 = load i8, i8* %82, !dbg !2170
/home/ron/Development/tinygo/tinygo/src/runtime/hashmap.go:335:19:
  %13 = call i1 @runtime.hashmapGet(%runtime.hashmap* %m, i8* %12, i8* %value, i32 %valueSize, i32 %11, i8* undef, i32 ptrtoint (%runtime.funcValueWithSignature* @"runtime.hashmapStringEqual$withSignature" to i32), i8* undef, i8* undef), !dbg !2059
/home/ron/.gvm/gos/go1.15/src/go/types/sizes.go:184:6:
  %13 = call i1 @runtime.hashmapStringGet(%runtime.hashmap* %9, i8* %11, i32 %12, i8* %hashmap.value.bitcast, i32 4, i8* undef, i8* null), !dbg !2055
go/types/:202:24:
  %359 = call %runtime._interface @"go/types.SizesFor"(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @"go/types.init$string.1271", i32 0, i32 0), i32 2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @"go/types.init$string.1272", i32 0, i32 0), i32 5, i8* undef, i8* undef), !dbg !2199

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/quick

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

# testing/quick
/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:273:11: fType.NumOut undefined (type reflect.Type has no field or method NumOut)
/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:276:11: fType.Out undefined (type reflect.Type has no field or method Out)
/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:280:43: fType.NumIn undefined (type reflect.Type has no field or method NumIn)
/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:290:12: fVal.Call undefined (type reflect.Value has no field or method Call)
/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:320:43: xType.NumIn undefined (type reflect.Type has no field or method NumIn)
/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:330:26: x.Call undefined (type reflect.Value has no field or method Call)
/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:331:26: y.Call undefined (type reflect.Value has no field or method Call)
/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:351:25: f.In undefined (type reflect.Type has no field or method In)
/home/ron/.gvm/gos/go1.15/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.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...]