> ## Documentation Index
> Fetch the complete documentation index at: https://docs.switchport.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install the Switchport Go SDK

## Requirements

* Go 1.21 or higher
* Go modules enabled (default in Go 1.16+)

## Install via go get

The easiest way to install the Switchport SDK is using `go get`:

```bash theme={null}
go get github.com/switchport-ai/switchport-go
```

## Add to go.mod

Alternatively, add it directly to your `go.mod` file:

```go theme={null}
require github.com/switchport-ai/switchport-go v0.1.0
```

Then run:

```bash theme={null}
go mod tidy
```

## Verify Installation

Verify that the SDK is installed correctly:

```go theme={null}
package main

import (
	"fmt"

	"github.com/switchport-ai/switchport-go/switchport"
)

func main() {
	client, err := switchport.NewClient("sp_test_key")
	if err != nil {
		panic(err)
	}
	fmt.Printf("Switchport client initialized successfully\n")
}
```

## Dependencies

The Switchport Go SDK has **zero external dependencies** - it uses only the Go standard library:

* `net/http` - For HTTP requests to the Switchport API
* `encoding/json` - For JSON encoding/decoding
* `time` - For timestamp handling
* `errors` - For error handling

This minimal dependency footprint ensures compatibility and reduces the risk of dependency conflicts.

## Upgrading

To upgrade to the latest version:

```bash theme={null}
go get -u github.com/switchport-ai/switchport-go
```

Or update to a specific version:

```bash theme={null}
go get github.com/switchport-ai/switchport-go@v0.2.0
```

## Using with Go Workspaces

If you're using Go workspaces (Go 1.18+), the SDK works seamlessly:

```bash theme={null}
# Initialize workspace
go work init

# Add your module
go work use .

# Install switchport
go get github.com/switchport-ai/switchport-go
```

## Troubleshooting

### Module Cache Issues

If you encounter module cache issues, try clearing the cache:

```bash theme={null}
go clean -modcache
go get github.com/switchport-ai/switchport-go
```

### Go Version Issues

Make sure you're using Go 1.21 or higher:

```bash theme={null}
go version
```

If you need to update Go, visit [go.dev/dl](https://go.dev/dl/).

### Import Path Issues

Make sure you're importing from the correct path:

```go theme={null}
import "github.com/switchport-ai/switchport-go/switchport"
```

Note the `/switchport` subpackage at the end.

## Next Steps

<Card title="Authentication" icon="key" href="/sdk/go/authentication">
  Set up your API key and authenticate
</Card>
