> For the complete documentation index, see [llms.txt](https://docs.licensespring.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.licensespring.com/sdks/go-sdk/v2/build-your-program.md).

# Build your Program

When building your application using our SDK, we recommend two primary methods:

* Standard Go build
* Go build with Garble

Both approaches are valid; however, building with Garble provides additional benefits that are important to consider.

## Why Build with Garble?

[**Garble**](https://github.com/burrowers/garble) is a tool that works as a compiler wrapper around `go build`, designed to **obfuscate** Go code. Here’s why we encourage you to use it:

* **Obfuscation**: Garble reduces the risk of reverse-engineering by renaming symbols, stripping debug information, and minimizing the visibility of the internal structure of your binaries.
* **Security**: Protects proprietary algorithms, sensitive logic, and API interactions from easy inspection.
* **Reduced Binary Predictability**: Makes the binary less predictable, which can deter certain types of static analysis or targeted attacks.
* **Minimal Overhead**: Garble integrates easily into the Go toolchain without major changes to your build pipeline.

{% hint style="warning" %}
Important: Garble is best used in release builds. For development, use standard `go build` for faster builds and better debuggability.
{% endhint %}

## Build Methods

{% stepper %}
{% step %}

### Standard Go build

Build your project normally.

{% code title="Build (standard)" %}

```bash
go build -o your-program
```

{% endcode %}
{% endstep %}

{% step %}

### Go build with Garble

First, install Garble if you haven’t already:

{% code title="Install Garble" %}

```bash
go install mvdan.cc/garble@latest
```

{% endcode %}

Then build your project with Garble:

{% code title="Build (garble)" %}

```bash
garble build -o your-program
```

{% endcode %}

This will produce an obfuscated binary, making your application harder to reverse-engineer.
{% endstep %}
{% endstepper %}

## Additional Garble Options

<details>

<summary>Recommended Garble flags</summary>

Garble offers several options to fine-tune the obfuscation process. Some recommended flags:

* `-literals`: Obfuscates literals like strings and numbers.
* `-tiny`: Reduces binary size further and increases obfuscation.
* `-debug`: Enables some debug features (not recommended for production).

Example with extra obfuscation:

{% code title="Garble with options" %}

```bash
garble -literals -tiny build -o your-program
```

{% endcode %}

</details>

## Summary

| Build Method | Pros                                               | Cons                                      |
| ------------ | -------------------------------------------------- | ----------------------------------------- |
| go build     | Fast, easy, debuggable                             | No protection against reverse engineering |
| garble build | Obfuscated, more secure, less predictable binaries | Slightly slower builds, harder to debug   |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.licensespring.com/sdks/go-sdk/v2/build-your-program.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
