> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# habx/golang

Habx golang orb. This "orb" helps us to test and build applications at habx. It is used for all golang apps.


## Commands

### setup-github-private-pkg

Setup a private package for golang.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `username` | string |  | Define your github username |

## Jobs

### build

Build golang project


| Parameter | Type | Default | Description |
|---|---|---|---|
| `cache-key` | string | go-mod | The cache key to use. The key is immutable. |
| `dry-run-release` | boolean | true | Use try run for don't push release on github, see more https://goreleaser.com |
| `github-config-private-package` | boolean | false | Enable setup github private package |
| `github-config-private-username` | string |  | Setup rivate package github username |
| `goreleaser-version` | string | 1.2.5 | see more https://goreleaser.com |
| `store-artifacts` | boolean | false | Enable store artifacts |

### static-tests

Run golangci-lint on a project.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `github-config-private-package` | boolean | true | Enable setup github private package |
| `github-config-private-username` | string |  | Setup rivate package github username |

### tests

Run tests go `test`


| Parameter | Type | Default | Description |
|---|---|---|---|
| `cache-key` | string | go-mod | The cache key to use. The key is immutable. |
| `github-config-private-package` | boolean | true | Enable setup github private package |
| `github-config-private-username` | string |  | Setup rivate package github username |
| `upload-to-codecov` | boolean | true | Upload coverage.out to codecov |

### tests-localstack-and-pg

Run tests go `test` with localstack


| Parameter | Type | Default | Description |
|---|---|---|---|
| `aws-endpoint-url` | string | https://localhost.localstack.cloud:4566 | define aws s3 endpoint for testing |
| `aws-s3-bucket` | string |  | define aws s3 bucket name for testing |
| `cache-key` | string | go-mod | The cache key to use. The key is immutable. |
| `github-config-private-package` | boolean | true | Enable setup github private package |
| `github-config-private-username` | string |  | Setup rivate package github username |
| `localstack-host` | string | localstack | Localstack hostname |
| `upload-to-codecov` | boolean | true | Upload coverage.out to codecov |

## Executors

### default

This is a sample executor using Docker and Golang.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `tag` | string | 1.19 | Pick a specific circleci/node image variant: https://hub.docker.com/r/cimg/go/tags
 |

### golang-postgres

This is a sample executor using Docker, Golang and postgres.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `postgres-database` | string | test-db | Used to define a different name for the default database
 |
| `postgres-password` | string | azerty | This environment variable sets the superuser password for PostgreSQL.
 |
| `postgres-tag` | string | 14 | Pick a specific postgres image variant: https://hub.docker.com/_/postgres?tab=tags
 |
| `postgres-user` | string | test | This variable will create the specified user with superuser power and a database with the same name.
 |
| `tag` | string | 1.19 | Pick a specific circleci/go image variant: https://hub.docker.com/r/cimg/go/tags
 |

### golang-postgres-localstack

This is a sample executor using Docker, Golang postgres and localstack.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `localstack-tag` | string | 1.0.3 | Pick a specific localstack/localstack image variant: https://hub.docker.com/r/localstack/localstack/tags
 |
| `postgres-database` | string | test-db | Used to define a different name for the default database
 |
| `postgres-password` | string | azerty | This environment variable sets the superuser password for PostgreSQL.
 |
| `postgres-tag` | string | 14 | Pick a specific postgres image variant: https://hub.docker.com/_/postgres?tab=tags
 |
| `postgres-user` | string | test | This variable will create the specified user with superuser power and a database with the same name.
 |
| `tag` | string | 1.19 | Pick a specific circleci/go image variant: https://hub.docker.com/r/cimg/go/tags
 |

## Examples

### build

build golang app


```yaml
version: '2.1'
orbs:
  golang: habx/golang@1.2.3
workflows:
  use-my-orb:
    jobs:
      - golang/build
```