Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
dockertest
Write better integration tests! Dockertest helps you boot up ephermal docker images for your Go tests with minimal work.
-
validator
:100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
-
simple_gopher
Boilerplate for writing Go applications without framework using hexagonal application development approach
-
notify
A microservice using Redis to enable a stateful multi-channel notification system (by go-bridget)
-
upper.io/db
Data access layer for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
As u/GingaNinja741 mentioned, I think for project structure this project gives you a good idea but there is no real rule here. Some folders like internal are part of the language and will affect imports or usage from other modules. https://github.com/golang-standards/project-layout
https://github.com/uber-go/zap for logging. This logger is fast. You might not think that's important, but when we moved from Logrus to Zap we saw a noticeable difference in performance of some high-traffic applications.
Do you like an ORM like eloquent for Laravel? Then I can recommend GORM https://gorm.io/
bring your own tools - this is where you select your libraries and then wire them together manually. Most libraries play very well with other libraries https://github.com/avelino/awesome-go -- so it can be easier than in other languages. This approach is very common.
I'm a big fan of [Twirp RPC](https://github.com/twitchtv/twirp), and [go-chi/chi](https://github.com/go-chi/chi) if I need to provide REST endpoints, authentication or other routing middleware. The "gorilla" set of packages are also useful, I always reach for gorilla/websocket if I need to do some websocket work. You can look at an example service in [go-bridget/notify](https://github.com/go-bridget/notify) - the main files to look at are under rpc/notify/notify.proto/.go, and the implementation which you write is under server/notify. If you'd create database drivers, I'd create a package under server/notify/mysql (for example), and then implement an interface for data retrieval/settings. It's on the todolist, if I'll ever need to implement anything other than JWT, or Redis. Comment if you have any questions or notes.
Routing: https://github.com/gorilla/mux
Instrumentation: https://github.com/prometheus/client_golang
SQL Generation: https://github.com/Masterminds/squirrel
Checking for equality in tests: https://github.com/google/go-cmp
Integration tests: https://github.com/ory/dockertest
For what you are trying to do with micro services I would recommend having a main service and just make your modules folders in that repo. Let's say I make a repo at github.com/uberswe/microservice1 then I might let microservice 2 import the database package defined in microservice1 using github.com/uberswe/microservice1/database
I use github.com/go-playground/validator/v10 for validation, and it's simple enough.
https://github.com/doug-martin/goqu for building SQL queries. Supports MySQL and Postgres at least - super handy!
https://micro.mu/ - a framework based approach that selects the core stuff you need.
I'm a big fan of [Twirp RPC](https://github.com/twitchtv/twirp), and [go-chi/chi](https://github.com/go-chi/chi) if I need to provide REST endpoints, authentication or other routing middleware. The "gorilla" set of packages are also useful, I always reach for gorilla/websocket if I need to do some websocket work. You can look at an example service in [go-bridget/notify](https://github.com/go-bridget/notify) - the main files to look at are under rpc/notify/notify.proto/.go, and the implementation which you write is under server/notify. If you'd create database drivers, I'd create a package under server/notify/mysql (for example), and then implement an interface for data retrieval/settings. It's on the todolist, if I'll ever need to implement anything other than JWT, or Redis. Comment if you have any questions or notes.
I'm a big fan of [Twirp RPC](https://github.com/twitchtv/twirp), and [go-chi/chi](https://github.com/go-chi/chi) if I need to provide REST endpoints, authentication or other routing middleware. The "gorilla" set of packages are also useful, I always reach for gorilla/websocket if I need to do some websocket work. You can look at an example service in [go-bridget/notify](https://github.com/go-bridget/notify) - the main files to look at are under rpc/notify/notify.proto/.go, and the implementation which you write is under server/notify. If you'd create database drivers, I'd create a package under server/notify/mysql (for example), and then implement an interface for data retrieval/settings. It's on the todolist, if I'll ever need to implement anything other than JWT, or Redis. Comment if you have any questions or notes.
upper.io is a viable alternative to GORM. Just a suggestion.
Mgo has been unmaintained for years. Use the official https://github.com/mongodb/mongo-go-driver