---
product: Chilkat
product_version: 11.7.0
language: go
language_label: Go
document: language guide
---
> Chilkat 11.7.0 · language=go · this file: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/go/guide.md`
> Class pages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/go/classes/<Class>.md`

# Chilkat for Go — language guide — v11.7.0

## 1. Which Chilkat binding this is

This is the **Chilkat Go package** (`import "chilkat"`): constructors `chilkat.NewHttp()`, `chilkat.NewZip()`, …, with a matching `DisposeHttp()` method; properties are methods (`http.SetPort(443)`, `http.Port()`); methods return Go values, with string results as `*string` (nil on failure). Built as a cgo package over the native library; no other binding exists for Go.

## 2. Install and requirements

The package is downloaded and built per platform; follow the instructions for your OS: [https://www.chilkatsoft.com/go.asp](https://www.chilkatsoft.com/go.asp) (Windows incl. MinGW, Linux, macOS).

## 3. Unlocking and object creation

```go
import (
    "fmt"
    "chilkat"
)

// Required once per process, before any other Chilkat object. Any string unlocks a 30-day trial.
glob := chilkat.NewGlobal()
defer glob.DisposeGlobal()
success := glob.UnlockBundle("Anything for 30-day trial")
if success != true {
    fmt.Println(*glob.LastErrorText())
    return
}

http := chilkat.NewHttp()
defer http.DisposeHttp()
```

- Unlocking only sets a flag in memory: no license files, no network call, so the call is repeated each time the program runs. Extra calls are harmless no-ops; the `Global` object can be discarded afterwards.
- If a program forgets to unlock, Chilkat runs in trial mode and stops working when the trial expires — always include the call, and use the purchased unlock code in production.
- `UnlockBundle` unlocks every class; per-class `UnlockComponent` methods exist only in old code.

## 4. Error model

Chilkat methods **do not panic** for Chilkat-level failures and do not return Go `error` values. The note under each method on the class page says how it reports failure: a bool status method returns `false`; a string-returning method returns a `*string` that is `nil` on failure; an object-returning method returns `nil`; for an int result check `LastMethodSuccess()`. `*obj.LastErrorText()` holds the diagnostic in every case.

Literals in Go: true is `true`, false is `false`, null/none is `nil`.

## 5. Strings, bytes and encodings

- Strings go in as Go `string` and come out as `*string` (dereference after checking for nil). A `charset` argument names the encoding of the *bytes* being produced or read.
- Binary data is `[]byte` in and out; larger or reusable data goes through `chilkat.BinData` (`Bd` methods) and text through `chilkat.StringBuilder` (`Sb` methods).
- Methods with `2`/`3` suffixes or `Quick*` prefixes are distinct members, not overloads.

## 6. Object lifetime and threading

Every object created with `NewXxx()` must be released with its `DisposeXxx()` method (typically `defer`red); objects returned by methods are released the same way. The Go garbage collector does not free the native object.

A Chilkat object may be used from any thread, but **one object must not be used by two threads at the same time**: create one object per thread or protect it with a lock. Objects are independent — there is no shared global state other than the unlock flag and the few `Global` settings.

## 7. Progress callbacks and async

This binding has **no progress callbacks**. For progress, percent-done or cancellation, use the `*Async` variant of a method (every method with an "Async variant" line on its class page has one). `XAsync` takes the same arguments, returns a `Task` immediately, and the result is read from the task after it finishes: run it, poll `Finished` (or wait), then `GetResultBool` / `GetResultString` / `GetResultBytes` etc.; `PercentDone` and `Cancel` are on the task. No new Async methods are added from 11.7.0 on.

## 8. Common mistakes an AI makes with this binding

1. Forgetting `DisposeXxx()` (native memory is not garbage-collected).
2. Treating a `*string` result as a `string`, or dereferencing it without the nil check.
3. Expecting an `error` return value — check the bool/nil result and `LastErrorText()` instead.
4. Omitting `Global.UnlockBundle` (the program runs in trial mode and stops working after 30 days).
5. Inventing members by analogy with other libraries. If a member is not on the class page, it does not exist — look it up rather than guessing.
6. Using deprecated members that older examples still show. The class page lists each one with its replacement; `deprecated.md` lists them all.
7. Ignoring the failure path. Every Chilkat method reports failure (see each method's note); `LastErrorText` says why, and printing it is the first debugging step.
8. Using one Chilkat object from two threads at the same time. Create one object per thread, or protect it with a lock.

## 9. Instructions block for coding agents

Paste into `CLAUDE.md`, `.cursor/rules`, or Copilot instructions:

```
This project uses Chilkat 11.7.0 from Go (the chilkat Go package: chilkat.NewHttp() ... DisposeHttp()).
- Reference: https://www.chilkatsoft.com/ai-docs/v/11.7.0/go/ — read guide.md once, then classes/<Class>.md for each class used.
- Call chilkat.NewGlobal().UnlockBundle(...) once at startup; defer DisposeXxx() on every object.
- No error values and no panics: status methods return false, string methods return a nil *string; print *obj.LastErrorText() on failure.
- Never use a member that is not on the class page; never use members listed as deprecated.
```

## 10. Classes

[Class index for Go](https://www.chilkatsoft.com/ai-docs/v/11.7.0/go/index.md)
