{"id":22372054,"url":"https://github.com/cogolabs/go-boilerplate","last_synced_at":"2025-10-04T10:23:34.764Z","repository":{"id":55397679,"uuid":"146936785","full_name":"cogolabs/go-boilerplate","owner":"cogolabs","description":"Go boilerplate web server with all Cogo specific best practices","archived":false,"fork":false,"pushed_at":"2022-04-15T17:50:12.000Z","size":1804,"stargazers_count":28,"open_issues_count":0,"forks_count":5,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-06T14:07:26.422Z","etag":null,"topics":["boilerplate","golang","handler","metrics","prometheus","router"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cogolabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-31T19:55:10.000Z","updated_at":"2023-11-18T17:11:21.000Z","dependencies_parsed_at":"2022-08-14T23:20:48.716Z","dependency_job_id":null,"html_url":"https://github.com/cogolabs/go-boilerplate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cogolabs/go-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogolabs%2Fgo-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogolabs%2Fgo-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogolabs%2Fgo-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogolabs%2Fgo-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cogolabs","download_url":"https://codeload.github.com/cogolabs/go-boilerplate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogolabs%2Fgo-boilerplate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267945013,"owners_count":24170214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boilerplate","golang","handler","metrics","prometheus","router"],"created_at":"2024-12-04T20:33:02.548Z","updated_at":"2025-10-04T10:23:29.739Z","avatar_url":"https://github.com/cogolabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Table of Contents\n\n- [Overview](#overview)\n- [cmd](#cmd)\n- [pkg](#pkg)\n- [internal](#internal)\n- [metrics and pprof](#metrics-and-pprof)\n- [web](#web)\n- [testing](#testing)\n- [Github Actions](#github-actions)\n\n# Overview\n\nGo boilerplate is a simple web server starter pack with Cogo's best practices. These are standard across all projects to ensure easy interoperability, understandability, and discoverability.\n\nTo get started, we recommend reading [Go By Example](https://gobyexample.com/), then, after getting more comfortable with the language, [Effective Go](https://go.dev/doc/effective_go). You should also be familiar with [Go Modules](https://go.dev/blog/using-go-modules).\n\n# cmd\n\nThe `cmd` directory holds entrypoints into your application. Each binary that gets built and run gets their own directory and `main.go` inside the `cmd` directory.\n\n# pkg\n\nThe `pkg` directory holds the majority of your source code. Anything that you will need to access from inside and your repository or other packages lives here.\n\n# internal\n\nThe `internal` directory holds your source code that must never be imported by other go modules. The go compiler does not allow imports from `internal` packages that are outside your module.\n\n# metrics and pprof\n\nWe use Prometheus for our application metrics, see `pkg/metrics/metrics.go`. You'll need to set up a prometheus scraper to ingest these metrics.\n\n[pprof](https://jvns.ca/blog/2017/09/24/profiling-go-with-pprof/) lets you collect useful data on the state of a running go program.\n\n# web\n\nFor its rich functionality, we use `github.com/gorilla/mux` for handling HTTP requests.\n\n# testing\n\nTests are written in files named `*_test.go` and can be run with the `go test` tool.\n\nAll golang test functions must start with `Test` in their names, in order for them to be visible to the go tester. Each test should accept the first argument `(t* Testing.t)`, which will most likely be the only argument you need. We use [stretchr/testify](https://github.com/stretchr/testify) as our assertion library to ensure correctness.\n\n# Github Actions\n\nWe use Github Actions to compile and test our code on every push. Depending on the project, we may also use it for continuous delivery. The yaml in `.github/workflows/` defines how the code should be built and how the tests should be run.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcogolabs%2Fgo-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcogolabs%2Fgo-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcogolabs%2Fgo-boilerplate/lists"}