<aside> ❗ This is outdated, use another structure, but at the moment im not sure whis is the best.

</aside>

  1. Create a Go-Project

  2. in the root you have a main.go

  3. then create following folders

    1. scripts → for workers where run only one time or in certain intervals
    2. global → e.g. clients, where be available in the whole project
    3. router → for the API → use gin-gonic
    4. models → for all Models you need
    5. pkg → for all packages who you create
      1. IAM → e.g. Zitadel
      2. Logging → Glichtip (Sentry)
      3. Database → CRUD-functions,…
    6. *(microservices → if you create microservices, here you need to exclude this folder in the swagger → [go get -u github.com/swaggo/swag/cmd/swag go install github.com/swaggo/swag/cmd/swag go get -u github.com/swaggo/gin-swagger go get -u github.com/swaggo/files

    swag init --parseInternal --parseDependency true # if this not work use this

    go run github.com/swaggo/swag/cmd/swag init --parseInternal --parseDependency true

    If the functions are in several files, you must add the following parameters to swag init:

    --parseDependency true

    if you want to exluce a directory add this param

    --exclude './directory' # e.g. --exclude './microservices'

    ****# If there a Error zsh not found:

    export PATH="/Users/XXX/go/bin:$PATH"

    export PATH="/Users/mattiamueggler/go/bin:$PATH" swag -v](https://mattiamueggler.notion.site/go-get-u-github-com-swaggo-swag-cmd-swag-go-install-github-com-swaggo-swag-cmd-swag-go-get-u-githu-6a495c2b88764049b6208a496a6979c8) )*

  4. work with Pointers, create a struct with funcitons and models and refer to this → func (p *struct) funcName() {}

  5. Use for API-requests go-resty


https://github.com/golang-standards/project-layout