The most useful libraries for a golang developer



What are the most useful libraries for a golang developer?


most useful libraries for a golang developer

1. Golang-Set
Go has arrays, slices and maps, but it doesn't have a set data structure. You can mimic a set with a map of bools, but it's nice to have an actual data type with the right operations and semantics.
This is where golang-set comes in.
2. Color
Let's continue with the color theme. When writing command-line programs, it is useful to use colors to highlight important messages or distinguish between errors, successes, and warnings.
The color package gives an easy way to add some color to your programs (see what I did there?). It uses ANSII escape codes and supports Windows too!
3. Gen
The gen tool generates code for you—in particular, type-aware code that tries to alleviate the gap of not having templates or generics in Go.
You annotate your types with a special comment, and gen generates source files that you include in your project. No runtime magic.
4. Gorm
Go is known for its spartan nature. Database programming is no different. Most popular DB libraries for Go are pretty low-level. Gorm brings the world of object-relational mapping to Go with the following features:
  • Associations (Has One, Has Many, Belongs To, Many To Many, Polymorphism)
  • Callbacks (Before/After Create/Save/Update/Delete/Find)
  • Preloading (eager loading)
  • Transactions
  • Composite Primary Key
  • SQL Builder
  • Auto Migrations
  • Logger
  • Extendable, write Plugins based on GORM callbacks
But it doesn't cover everything.
If you come from Python, don't expect SQLAlchemy magic.
For more fancy stuff, you'll have to go a lower level.
5. Goose
One of the most important tasks when working with relational databases is managing the schema.
Modifying the DB schema is considered a "scary" change in some organizations. The goose package lets you perform schema changes and even data migrations if needed. You can goose up and goose down to go back and forth. Mind your data, though, and make sure it doesn't get lost or corrupted.
Goose works by versioning your schema and using migration files corresponding to each schema. The migration files can be SQL commands or Go commands. Here is an example of a SQL migration file that adds a new table:
6. Ginkgo
Ginkgo is a BDD (Behavior Driven Development) testing framework. It lets you write your tests in a syntax that resembles English and allow less technical people to review tests (and their output) and verify that they match the business requirements.
Some developers like this style of test specification too. It integrates with Go's built-in testing package and is often combined with Gomega.
7. Etcd
Etcd is a reliable distributed Key-Value store. The server is implemented in Go, and the Go client interacts with it though gRPC.
It focuses on the following:
  • Simple: well-defined, user-facing API (gRPC).
  • Secure: automatic TLS with optional client cert authentication.
  • Fast: benchmarked 10,000 writes/sec.
  • Reliable: properly distributed using Raft.
8. NSQ
NSQ is a great distributed queue. I've used it successfully as a primary building block for large-scale distributed systems. Here are some of its features:
  • Support distributed topologies with no SPOF.
  • Horizontally scalable (no brokers, seamlessly add more nodes to the cluster).
  • Low-latency push based message delivery (performance).
  • Combination load-balanced and multicast style message routing.
  • Excel at both streaming (high-throughput) and job oriented (low-throughput) workloads.
  • Primarily in-memory (beyond a high-water mark messages are transparently kept on disk).
  • Runtime discovery service for consumers to find producers (nsqlookupd).
  • Transport layer security (TLS).
  • Data format agnostic.
  • Few dependencies (easy to deploy) and a sane, bounded, default configuration.
  • Simple TCP protocol supporting client libraries in any language.
  • HTTP interface for stats, admin actions, and producers (no client library needed to publish).
  • Integrates with statsd for real-time instrumentation.
  • Robust cluster administration interface (nsqadmin).
If you know about anymore useful libraries feel free to leave them in t

Post a Comment

5 Comments

  1. Such a valuable post, our organization iPad Hire Connecticut is very thankful to you for sharing good information.

    ReplyDelete
  2. That's a fantastic post i really amazed to see this informative post you do great job like this https://logonick.com/

    ReplyDelete
  3. Here is no doubt that you shared informational article over golang development and currently many golang development companies are relying for go language. I hope you will share another article for help to us.

    ReplyDelete
  4. Nice blog Thank you very much for the information you shared.
    Golang Development Company

    ReplyDelete