Go Base Library

The Go Base Library is a library of APIs commonly used by Go applications.

Different from our approach on the Swift Base Library, the Go Base Library is not implemented from scratch. Instead it is a fork of the official base library provided by Google's Go Language team, which is licensed under a BSD-style license.

Supported Platforms

The Go Base Library is available for .NET and Island-backed platforms (except WebAssembly). This includes Cocoa, Android NDK, Windows and Linux.

Due to platform limitations, it is not currently available for Java and Android SDK projects, for the legacy Toffee V1 Cocoa projects (it is supported for newer Island/Darwin-based Cocoa projects), or for WebAssembly.

The Go language syntax itself, and the ability to compile .go files is of course supported on all these platforms, it is just the base library that is not available.

Availability

The Go Base Library ships precompiled with the Elements compiler, and new .NET and Island-based projects created with one of the RemObjects Gold project templates will automatically have a reference to it. If you are adding Go files to a project that started out with a different language, you can add a reference to your projects via the Add References dialog in Fire, Water or Visual Studio, where the Go library should show automatically.

The library is called Go.dll on .NET, Go.fx on Island and go.jar on Java. Its content is contained in the a variety of namespaces.

Most of the types and functions exposed in the library are perfectly valid to be used from Oxygene, C#, Swift and Java, as well. In these languages, the builtin namespace will need to be explicitly specified or added to the uses/using/import section.

Overview

The Go library provides assistance on many different areas. The list below includes some highlights:

  • archive: manage tar and zip files (read/write).
  • bufio: implement buffered I/O.
  • bytes: helpers for slice of bytes, very commonly used in Go.
  • compress: decompress bzip2, use deflate compressed data format and read/write gzip, lzw and zlib.
  • container: doubled linked list and ring.
  • crypto: contains implementations to encrypt/decrypt using different algorithms and hashes: AES (Rijndael), Data Encryption Standard (DES) and Triple Data Encryption Algorithm (TDEA), Digital Signature Algorithm (DSA), Elliptic Curve Digital Signature Algorithm (ECDSA), Ed25519 Signature algorithm, Keyed-Hash Message Authentication Code (HMAC), MD5 hash, RC4, RSA, SHA-1, SHA224, SHA256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256 hash algorithms, TLS 1.2 and TLS 1.3 (1.3 disabled for now, will be fixed in few days), x509 to parse x.509 keys and certificates, CRL and OCSP.
  • database: interfaces around generic sql drivers.
  • encoding: encode/decode data from different formats, such as ascii85 data encoding (as used in the btoa tool and Adobe's PostScript and PDF document formats), ASN.1, base32 and base64, binary, CSV, gob streams, hexadeximal parsing, Json, PEM and XML.
  • fmt: formatted input/output similar to C's printf()/scanf().
  • hash: adler32, crc32, crc64 , fnv-1 and fnv-1a checksums algorithms.
  • html: escaping/unscaping html functions and template engine.
  • image: color, drawing and palette basic library, support for reading/writing .fig, .jpeg and .png formats.
  • mime:s implement parts of the MIME: multipart (RFC 2046) and quotedprintable (RFC 2045).
  • net: network functionality, from TCP/UDP connections, DNS, complete http client / server, with TLS, CGI, FastCGI, parsing mail messages, rpc, smtp, url parsing.
  • regexp: reguar expressions search.
  • strconv: conversions to and from string.
  • strings: UTF-8 strings functions.
  • sync: basic synchronization primitives.
  • text: UTF-8 token scanner and templates.
  • time: time and time duration functions.

Detailed Documentation

While this site provides pages for all types shipped as part of the Go library fork, we are not duplicating the documentation texts. Please refer to the official documentation at golang.org/pkg/ for these types.

Source Code

The Go Base Library is open source and implemented in Go and Oxygene. You can find the source code on GitHub, and contributions and pull requests are more than welcome.

The forked library falls into two distinct categories of files:

  • all .go files are maintained as exact copies of the originals, to ensure all types work and behave in the exact same way as with standard Go, and that the code remains upgradable as the Go team evolves their standard library.
  • all .pas files are additional files we provide, to implement functionality that is not available as pure Go code (i.e. where the standard Go library relies on external code as well, be it operating system APIs or functionality provided by different libraries).

With a combination of the two, the Go Base Library provides a fully Elements-native functionality of the exposed feature set.

Note that you will need the very latest compiler to rebuild the GBL, and in some cases, the git repository might even contain code that requires a later compiler than is available. Refer to the commit messages for details on this, and check out an older revision, if necessary.

Types

Structs

Interfaces

Enums

Aliases

  • bool = Boolean
  • byte = Byte  .NET, .NET Standard 2.0, Island
  • CancelFunc = CancelFunc  .NET, .NET Standard 2.0, Island
  • ChanDir = int  .NET, .NET Standard 2.0, Island
  • Context = Context  .NET, .NET Standard 2.0, Island
  • DecrypterOpts = Object  .NET, .NET Standard 2.0, Island
  • float32 = Single
  • float64 = Double
  • int = Int64  .NET, .NET Standard 2.0, Island
  • int16 = Int16  .NET, .NET Standard 2.0, Island
  • int32
    • Int32  .NET, .NET Standard 2.0, Island
    • Integer  Cooper
  • int8 = SByte  .NET, .NET Standard 2.0, Island
  • intptr
  • Kind = uint  .NET, .NET Standard 2.0, Island
  • PlatformEnumerator
  • PlatformExtendedType
    • MemberInfo  .NET, .NET Standard 2.0
    • MemberInfo  Island
  • PlatformField
    • FieldInfo  .NET, .NET Standard 2.0
    • FieldInfo  Island
  • PlatformMath
    • Math  .NET, .NET Standard 2.0
    • Math  Island
  • PlatformMethod
    • MethodInfo  .NET, .NET Standard 2.0
    • MethodInfo  Island
  • PlatformRandom
    • Random  .NET, .NET Standard 2.0
    • Random  Island
  • PlatformString = String  .NET, .NET Standard 2.0, Island
  • PlatformTimer
    • Timer  .NET, .NET Standard 2.0
    • Timer  Island
  • PlatformType
    • Type  .NET, .NET Standard 2.0
    • Type  Island
  • Pointer
  • PrivateKey = Object  .NET, .NET Standard 2.0, Island
  • ProcessType
    • Process  .NET, .NET Standard 2.0
    • Process  Island
  • PublicKey = Object  .NET, .NET Standard 2.0, Island
  • syscallErrorType = Errno  .NET, .NET Standard 2.0, Island
  • TCPConn = IPConn  .NET, .NET Standard 2.0, Island
  • Token = Object  .NET, .NET Standard 2.0, Island
  • Token = Object  .NET, .NET Standard 2.0, Island
  • Token = Object  .NET, .NET Standard 2.0, Island
  • UDPConn = IPConn  .NET, .NET Standard 2.0, Island
  • uint = UInt64  .NET, .NET Standard 2.0, Island
  • uint16 = UInt16  .NET, .NET Standard 2.0, Island
  • uint32
  • uint8 = Byte  .NET, .NET Standard 2.0, Island
  • uintptr
  • UnixConn = IPConn  .NET, .NET Standard 2.0, Island
  • Value = Object  .NET, .NET Standard 2.0, Island

See Also