github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/docs/concepts/stdlibs/stdlibs.md (about) 1 --- 2 id: stdlibs 3 --- 4 5 # Standard Libraries 6 7 Gno comes with a set of standard libraries which are included to ease development and provide extended functionality to the language. These include: 8 - standard libraries as we know them in classic Go, i.e. `encoding/binary`, `strings`, `testing`, etc. 9 - a special `std` package, which contains types, interfaces, and APIs created to handle blockchain-related functionality. 10 11 Standard libraries differ from on-chain packages in terms of their import path structure. 12 Unlike on-chain [packages](../packages.md), standard libraries do not incorporate a domain-like format at the beginning 13 of their import path. For example: 14 - `import "encoding/binary"` refers to a standard library 15 - `import "gno.land/p/demo/avl"` refers to an on-chain package. 16 17 To see concrete implementation details & API references, see the [reference](../../reference/stdlibs/stdlibs.md) section. 18 19 ## Accessing documentation 20 21 Apart from the official documentation you are currently reading, you can also access documentation for the standard 22 libraries in several other different ways. You can obtain a list of all the available standard libraries with the following commands: 23 24 ```console 25 $ cd gnovm/stdlibs # go to correct directory 26 27 $ find -type d 28 ./testing 29 ./math 30 ./crypto 31 ./crypto/chacha20 32 ./crypto/chacha20/chacha 33 ./crypto/chacha20/rand 34 ./crypto/sha256 35 ./crypto/cipher 36 ... 37 ``` 38 39 All the packages have automatically generated documentation through the use of the 40 `gno doc` command, which has similar functionality and features to `go doc`: 41 42 ```console 43 $ gno doc encoding/binary 44 package binary // import "encoding/binary" 45 46 Package binary implements simple translation between numbers and byte sequences 47 and encoding and decoding of varints. 48 49 [...] 50 51 var BigEndian bigEndian 52 var LittleEndian littleEndian 53 type AppendByteOrder interface{ ... } 54 type ByteOrder interface{ ... } 55 $ gno doc -u -src encoding/binary littleEndian.AppendUint16 56 package binary // import "encoding/binary" 57 58 func (littleEndian) AppendUint16(b []byte, v uint16) []byte { 59 return append(b, 60 byte(v), 61 byte(v>>8), 62 ) 63 } 64 ``` 65 66 `gno doc` will work automatically when used within the Gno repository or any 67 repository which has a `go.mod` dependency on `github.com/gnolang/gno`. 68 69 Another alternative is setting your environment variable `GNOROOT` to point to 70 where you cloned the Gno repository. 71 72 ```sh 73 export GNOROOT=$HOME/gno 74 ```