go get github.com/spacecodewor/fmpcloud-go

6 Dependencies

Simple HTTP and REST client library for Go
Last ver 8mos ago
5.6K Stars
Now is a time toolkit for golang
Last ver 8mos ago
3.6K Stars
Simple error handling primitives
Last ver 1yr ago
7.4K Stars
Last ver 5mos ago
Package multierr allows combining one or more errors together. Errors can be combined with the use of the Combine function. If only two errors are being combined, the Append function may be used instead. The underlying list of errors for a returned error object may be retrieved with the Errors function. You sometimes need to append into an error from a loop. Cases like this may require knowledge of whether an individual instance failed. This usually requires introduction of a new variable. multierr includes AppendInto to simplify cases like this. This will append the error into the err variable, and return true if that individual error was non-nil. See AppendInto for more information. Go makes it possible to modify the return value of a function in a defer block if the function was using named returns. This makes it possible to record resource cleanup failures from deferred blocks. multierr provides the Invoker type and AppendInvoke function to make cases like the above simpler and obviate the need for a closure. The following is roughly equivalent to the example above. See AppendInvoke and Invoker for more information. Errors returned by Combine and Append MAY implement the following interface. Note that if you need access to list of errors behind a multierr error, you should prefer using the Errors function. That said, if you need cheap read-only access to the underlying errors slice, you can attempt to cast the error to this interface. You MUST handle the failure case gracefully because errors returned by Combine and Append are not guaranteed to implement this interface.
Last ver 5mos ago
Package zap provides fast, structured, leveled logging. For applications that log in the hot path, reflection-based serialization and string formatting are prohibitively expensive - they're CPU-intensive and make many small allocations. Put differently, using json.Marshal and fmt.Fprintf to log tons of interface{} makes your application slow. Zap takes a different approach. It includes a reflection-free, zero-allocation JSON encoder, and the base Logger strives to avoid serialization overhead and allocations wherever possible. By building the high-level SugaredLogger on that foundation, zap lets users choose when they need to count every allocation and when they'd prefer a more familiar, loosely typed API. In contexts where performance is nice, but not critical, use the SugaredLogger. It's 4-10x faster than other structured logging packages and supports both structured and printf-style logging. Like log15 and go-kit, the SugaredLogger's structured logging APIs are loosely typed and accept a variadic number of key-value pairs. (For more advanced use cases, they also accept strongly typed fields - see the SugaredLogger.With documentation for details.) By default, loggers are unbuffered. However, since zap's low-level APIs allow buffering, calling Sync before letting your process exit is a good habit. In the rare contexts where every microsecond and every allocation matter, use the Logger. It's even faster than the SugaredLogger and allocates far less, but it only supports strongly-typed, structured logging. Choosing between the Logger and SugaredLogger doesn't need to be an application-wide decision: converting between the two is simple and inexpensive. The simplest way to build a Logger is to use zap's opinionated presets: NewExample, NewProduction, and NewDevelopment. These presets build a logger with a single function call: Presets are fine for small projects, but larger projects and organizations naturally require a bit more customization. For most users, zap's Config struct strikes the right balance between flexibility and convenience. See the package-level BasicConfiguration example for sample code. More unusual configurations (splitting output between files, sending logs to a message queue, etc.) are possible, but require direct use of go.uber.org/zap/zapcore. See the package-level AdvancedConfiguration example for sample code. The zap package itself is a relatively thin wrapper around the interfaces in go.uber.org/zap/zapcore. Extending zap to support a new encoding (e.g., BSON), a new log sink (e.g., Kafka), or something more exotic (perhaps an exception aggregation service, like Sentry or Rollbar) typically requires implementing the zapcore.Encoder, zapcore.WriteSyncer, or zapcore.Core interfaces. See the zapcore documentation for details. Similarly, package authors can use the high-performance Encoder and Core implementations in the zapcore package to build their own loggers. An FAQ covering everything from installation errors to design decisions is available at https://github.com/uber-go/zap/blob/master/FAQ.md.
Last ver 5mos ago