Migrating from PHP to Go

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/golang

Our great sponsors
  • SonarLint - Clean code begins in your IDE with SonarLint
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • SaaSHub - Software Alternatives and Reviews
  • golang-standards/project-layout

    Standard Go Project Layout

    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

  • zap

    Blazing fast, structured, leveled logging in Go.

    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.

  • SonarLint

    Clean code begins in your IDE with SonarLint. Up your coding game and discover issues early. SonarLint is a free plugin that helps you find & fix bugs and security issues from the moment you start writing code. Install from your favorite IDE marketplace today.

  • GORM

    The fantastic ORM library for Golang, aims to be developer friendly

    Do you like an ORM like eloquent for Laravel? Then I can recommend GORM https://gorm.io/

  • go-formatter

    A curated list of awesome Go frameworks, libraries and software

    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.

  • chi

    lightweight, idiomatic and composable router for building Go HTTP services

    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.

  • mux

    A powerful HTTP router and URL matcher for building Go web servers with 🦍

    Routing: https://github.com/gorilla/mux

  • client_golang

    Prometheus instrumentation library for Go applications

    Instrumentation: https://github.com/prometheus/client_golang

  • InfluxDB

    Build time-series-based applications quickly and at scale.. InfluxDB is the Time Series Platform where developers build real-time applications for analytics, IoT and cloud-native services. Easy to start, it is available in the cloud or on-premises.

  • Squirrel

    Fluent SQL generation for golang

    SQL Generation: https://github.com/Masterminds/squirrel

  • go-cmp

    Package for comparing Go values in tests

    Checking for equality in tests: https://github.com/google/go-cmp

  • dockertest

    Write better integration tests! Dockertest helps you boot up ephermal docker images for your Go tests with minimal work.

    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

  • validator

    :100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving

    I use github.com/go-playground/validator/v10 for validation, and it's simple enough.

  • simple_gopher

    Boilerplate for writing Go applications without framework using hexagonal application development approach

  • goqu

    SQL builder and query library for golang

    https://github.com/doug-martin/goqu for building SQL queries. Supports MySQL and Postgres at least - super handy!

  • micro

    API first cloud platform (by micro)

    https://micro.mu/ - a framework based approach that selects the core stuff you need.

  • twirp

    A simple RPC framework with protobuf service definitions

    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.

  • notify

    A microservice using Redis to enable a stateful multi-channel notification system (by go-bridget)

    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/db

    Data access layer for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.

    upper.io is a viable alternative to GORM. Just a suggestion.

  • mongo-go-driver

    The Official Golang driver for MongoDB

    Mgo has been unmaintained for years. Use the official https://github.com/mongodb/mongo-go-driver

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts