Giter Club home page Giter Club logo

go-sdk's Introduction

go-sdk

Build Status

go-sdk is our core library of packages. These packages can be composed to create anything from CLIs to fully featured web apps.

The general philosophy is to provide loosely coupled libraries that can be composed as a suite of tools, vs. a do it all framework.

Packages

The main packages are as follows:

  • assert : helpers for writing tests; wraps *testing.T with more useful assertions.
  • collections : common collections like ringbuffers and sets.
  • configutil : helpers for reading config files.
  • cron : time triggered job management.
  • db : our postgres orm.
  • db/migration : helpers for writing postgres migrations.
  • env : helpers for reading / writing / testing environment variables.
  • exception : wraps error types with stack traces.
  • logger : our performance oriented event bus; event triggering is supported in most major packages.
  • oauth : a wrapper on golang.org/x/oauth2 that automates fetching profiles for google oauth.
  • proxy : an http/https reverse proxy.
  • proxy/proxy : a cli server the proxy.
  • raft : raft leader elections.
  • request : wrappers for http.Client with support for testing and a fluent api.
  • selector : a portable implementation of kubernetes selectors.
  • semver : semantic versioning helpers.
  • template : text-template helpers.
  • template/template : a cli for reading templates and outputting results.
  • util : the junk drawer of random stuff.
  • uuid : generate and parse uuid v4's.
  • web : our web framework; useful for both rest api's and view based apps.
  • workqueue : a background work queue when you need to have a fixed number of workers.
  • yaml : a yaml marshaller / unmarshaller. based on go-yaml.

Code Style Notes

  • Where possible, follow the golang proverbs.
  • The primary type a package exports should be creatable with a bare constructor New() unless there are non-trivial defaults to set.
  • "Fluent APIs"
    • Mutators that return a reference to the receiver, and don't produce an error, should start with With...().
    • This allows you to chain calls, ex. New().WithFoo(...).WithBar(...).
    • Mutators that can return an error should start with Set...()
  • Field accessors should be the uppercase name of the field, i.e. foo would have an accessor Foo().
  • Where possible, types should have a config object that fully represent the options you can set with With or Set mutators.
  • Said types should also have a constructor in the form NewFromEnv that uses the go-sdk/env package to read options set in the environment.
  • Minimize dependencies between packages as much as possible; add external dependencies with extreme care.
    • our only current external dependencies are the golang stdlib and github.com/lib/pq for the go-sdk/db.

Dependency Guidelines

  • assert should depend only on the stdlib.
  • exception should depend only on assert and the stdlib.
  • util should depenend only on exception, assert, and the stdlib.
  • logger should depend only on util, exception, assert, and the stdlib.
  • Internal package dependencies otherwise are fair game, but try and minimize coupling.
  • Do not add external packages unless absolutely necessary.
  • If you do have to add an external dependency, make sure it's included in make new-install.

Version Management

Generally we follow semantic versioning. What that means in practice:

[major].[minor].[patch]

We increment the major version if there are any breaking changes. A breaking change is defined as a change that would cause code written against the current major version having a build failure of any type. That's even for a trivial find and replace. Once you merge a new api or name for an object after CR, that's it.

We increment minor versions if we add new things that don't cause breaking changes.

We increment patch versions if we fix issues with the current set of objects.

To increment the local version

Patch:

make increment-patch

Minor:

make increment-minor

Major:

make increment-major

go-sdk's People

Contributors

gcarling avatar mat285 avatar tylerb-upw avatar wcharczuk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.