Skip to main content

Go - Gno compatibility

Reserved keywords

keywordsupport
breakfull
casefull
constfull
continuefull
defaultfull
deferfull
elsefull
fallthroughfull
forfull
funcfull
gomissing (after launch)
gotofull
iffull
importfull
interfacefull
packagefull
rangefull
returnfull
selectmissing (after launch)
structfull
switchfull
typefull
varfull

Generics are currently not implemented.

Note that Gno does not support shadowing of built-in types. While the following built-in typecasting assignment would work in Go, this is not supported in Gno.

rune := rune('a')

Builtin types

typeusagepersistency
boolfullfull
bytefullfull
int, int8, int16, int32, int64fullfull
uint, uint8, uint16, uint32, uint64fullfull
float32, float64fullfull
complex64, complex128missing (TBD)missing
uintptr, unsafe.Pointermissingmissing
stringfullfull
runefullfull
interface{}fullfull
[]T (slices)fullfull*
[N]T (arrays)fullfull*
map[T1]T2fullfull*
func (T1...) T2...fullfull (needs more tests)
*T (pointers)fullfull*
chan T (channels)missing (after launch)missing (after launch)

*: depends on T/T1/T2

Additional builtin types:

typecomment
bigintBased on math/big.Int
bigdecBased on https://github.com/cockroachdb/apd, (see https://github.com/gnolang/gno/pull/306)

Stdlibs

Legend:

  • nondet: the standard library in question would require non-deterministic behaviour to implement as in Go, such as cryptographical randomness or os/network access. The library may still be implemented at one point, with a different API.
  • gospec: the standard library is very Go-specific -- for instance, it is used for debugging information or for parsing/build Go source code. A Gno version may exist at one point, likely with a different package name or semantics.
  • gnics: the standard library requires generics.
  • test: the standard library is currently available for use exclusively in test contexts, and may have limited functionality.
  • cmd: the Go standard library is a command -- a direct equivalent in Gno would not be useful.
  • tbd: whether to include the standard library or not is still up for discussion.
  • todo: the standard library is to be added, and contributions are welcome.
  • part: the standard library is partially implemented in Gno, and contributions are welcome to add the missing functionality.
  • full: the standard library is fully implemented in Gno.
packagestatus
archive/tartbd
archive/ziptbd
arenaimprob
bufiofull
builtinfull1
bytesfull
cmd/*cmd
compress/bzip2tbd
compress/flatetbd
compress/gziptbd
compress/lzwtbd
compress/zlibtbd
container/heaptbd
container/listtbd
container/ringtbd
contexttbd
cryptotodo
crypto/aestodo
crypto/boringtbd
crypto/cipherpart
crypto/destbd
crypto/dsatbd
crypto/ecdhtbd
crypto/ecdsatbd
crypto/ed25519part8
crypto/elliptictbd
crypto/hmactodo
crypto/md5test2
crypto/randnondet
crypto/rc4tbd
crypto/rsatbd
crypto/sha1test2
crypto/sha256part3
crypto/sha512tbd
crypto/subtletbd
crypto/tlsnondet
crypto/tls/fipsonlynondet
crypto/x509tbd
crypto/x509/pkixtbd
database/sqlnondet
database/sql/drivernondet
debug/buildinfogospec
debug/dwarfgospec
debug/elfgospec
debug/gosymgospec
debug/machogospec
debug/pegospec
debug/plan9objgospec
embedtbd
encodingfull
encoding/ascii85todo
encoding/asn1todo
encoding/base32todo
encoding/base64full
encoding/binarypart
encoding/csvtodo
encoding/gobtbd
encoding/hexfull
encoding/jsontodo
encoding/pemtodo
encoding/xmltodo
errorspart
expvartbd
flagnondet
fmttest4
go/astgospec
go/buildgospec
go/build/constraintgospec
go/constantgospec
go/docgospec
go/doc/commentgospec
go/formatgospec
go/importergospec
go/parsergospec
go/printergospec
go/scannergospec
go/tokengospec
go/typesgospec
hashfull
hash/adler32full
hash/crc32todo
hash/crc64todo
hash/fnvtodo
hash/maphashtodo
htmlfull
html/templatetodo
imagetbd
image/colortbd
image/color/palettetbd
image/drawtbd
image/giftbd
image/jpegtbd
image/pngtbd
index/suffixarraytbd
iofull
io/fstbd
io/ioutilremoved5
logtbd
log/slogtbd
log/syslognondet
mapsgnics
mathfull
math/bigtbd
math/bitsfull
math/cmplxtbd
math/randfull9
mimetbd
mime/multiparttbd
mime/quotedprintabletbd
netnondet
net/httpnondet
net/http/cginondet
net/http/cookiejarnondet
net/http/fcginondet
net/http/httptestnondet
net/http/httptracenondet
net/http/httputilnondet
net/http/internalnondet
net/http/pprofnondet
net/mailnondet
net/netipnondet
net/rpcnondet
net/rpc/jsonrpcnondet
net/smtpnondet
net/textprotonondet
net/urlfull
osnondet
os/execnondet
os/signalnondet
os/usernondet
pathfull
path/filepathnondet
pluginnondet
reflecttodo
regexpfull
regexp/syntaxfull
runtimegospec
runtime/asangospec
runtime/cgogospec
runtime/coveragegospec
runtime/debuggospec
runtime/metricsgospec
runtime/msangospec
runtime/pprofgospec
runtime/racegospec
runtime/tracegospec
slicesgnics
sortpart6
strconvfull10
stringsfull
synctbd
sync/atomictbd
syscallnondet
syscall/jsnondet
testingpart
testing/fstesttbd
testing/iotesttbd
testing/quicktbd
text/scannertodo
text/tabwritertodo
text/templatetodo
text/template/parsetodo
timefull7
time/tzdatatbd
unicodefull
unicode/utf16full
unicode/utf8full
unsafenondet

Tooling (gno binary)

go commandgno commandcomment
go buggno bugsame behavior
go buildgno transpile -gobuildsame intention, limited compatibility
go cleangno cleansame intention, limited compatibility
go docgno doclimited compatibility; see https://github.com/gnolang/gno/issues/522
go envgno env
go fix
go fmtgno fmtgofmt (& similar tools, like gofumpt) works on gno code.
go generate
go getsee gno mod download.
go helpgno $cmd --helpie. gno doc --help
go install
go list
go modgno mod
+ go mod initgno mod initsame behavior
+ go mod downloadgno mod downloadsame behavior
+ go mod tidygno mod tidysame behavior
+ go mod whygno mod whysame intention
gno transpile
go work
gno repl
go rungno run
go testgno testlimited compatibility
go tool
go version
go vet
golintgno lintsame intention

  1. time.Now returns the block time rather than the system time, for determinism. Concurrent functionality (such as time.Ticker) is not implemented.
  2. strconv does not have the methods relating to types complex64 and complex128.
  3. sort has the notable omission of sort.Slice. You'll need to write a bit of boilerplate, but you can use sort.Interface + sort.Sort!
  4. math/rand in Gno ports over Go's math/rand/v2.
  5. io/ioutil is deprecated in Go. Its functionality has been moved to packages os and io. The functions which have been moved in io are implemented in that package.
  6. like many other encoding packages, fmt depends on reflect to be added. For now, package gno.land/p/demo/ufmt may do what you need. In test functions, fmt works.
  7. crypto/sha256 is currently only implemented for Sum256, which should still cover a majority of use cases. A full implementation is welcome.
  8. crypto/sha1 and crypto/md5 implement "deprecated" hashing algorithms, widely considered unsafe for cryptographic hashing. Decision on whether to include these as part of the official standard libraries is still pending.
  9. crypto/ed25519 is currently only implemented for Verify, which should still cover a majority of use cases. A full implementation is welcome.
  10. builtin is a "fake" package that exists to document the behaviour of some builtin functions. The "fake" package does not currently exist in Gno, but all functions up to Go 1.17 exist, except for those relating to complex or channel types.