Skip to content

Releases: TouchBistro/goutils

v0.5.0

29 Sep 23:06
167f7ad
Compare
Choose a tag to compare

New packages:

logutil: The new logutil package provides utilities that extend the functionality of the log/slog package.

Minor Changes:

color:

  • Added the Colorer type which can be used to disable colours in a local context without affecting the global functions.
  • Added IsNoColorEnvSet() to see if NO_COLOR is set.

Breaking Changes:

progress:

  • The Logger interface has been updated to work with log/slog and logutil. Logger.WithFields has been replaced with Logger.WithAttrs and the Fields type is gone. The Debug/Info/Warn/Error methods require the message as the first argument, subsequent arguments are expected to be attributes that will be added to the log.
  • PlainTracker has been removed. See the changes to the spinner package for how to achieve the same functionality.

spinner:

  • Tracker has been removed. Instead NewTracker() can be used to create a progress.Tracker with the given options. The DisableSpinner option can be used to achieve the same functionality that progress.PlainTracker previously provided.

v0.4.0

22 Dec 19:06
7d30e22
Compare
Choose a tag to compare

New packages:

async: The new async package provides functionality for working with async operations. It provides the Group type which can be used to execute a list of related operations in parallel and collect the results.

Minor Changes:

progress:

  • Added ContextWithTrackerUsingKey and TrackerFromContextUsingKey which work the same as ContextWithTracker and TrackerFromContext but allow setting a custom context key.
  • Added RunOptions.TrackerKey and RunParallelOptions.TrackerKey which can be used to specify the key to use to retrieve the Tracker from the context.
  • RunParallel/RunParallelT now return results in the same order that they were run. These semantics are documented in the godoc and are part of the API contract now.

Breaking Changes:

command:

  • Command.Exec and Exec now require a context.Context as the first parameter. This context is used to kill the command process if the context becomes done before the process completes on its own.

progress:

  • Run/RunT and RunParallel/RunParallelT no longer return immediately if the context becomes done but rather wait for the running functions to complete. This behaviour was deemed undesirable as it meant that operations were still running concurrently after Run/RunParallel returned which might be unexpected. The semantics now are that when Run/RunParallel return, there are no concurrent operations running. It is up to callers to ensure that their functions use the context properly to handle timeouts/cancellations.
  • RunParallel/RunParallelT no longer return immediately if CancelOnError is true but wait for the running functions to complete for the same reasons as describe in the previous point.

v0.3.2

28 Jul 21:05
7b3c66f
Compare
Choose a tag to compare

Minor Changes:

progress:

  • Fixed issue with Run and RunT not respecting RunOptions.Count.

v0.3.1

17 Jun 20:12
4468c71
Compare
Choose a tag to compare

Minor Changes:

progress:

  • Added RunT and RunParallelT which support returning values from the run function.

text:

  • Added VariableMapper type which can be used with ExpandVariables and ExpandVariablesString which keeps track of missing variables.

v0.3.0

21 Jan 21:32
ee8dcf3
Compare
Choose a tag to compare

New packages:

log: The new log package provides a simple yet powerful structured logger that can log at different levels.
The Logger type implements the progress.Logger and progress.OutputLogger interfaces, making it easy to use with the progress package.

Minor Changes:

progress:

  • Added RunOptions.Count field to allow specifying a count for the spinner run by Run.

Breaking Changes:

command:

  • Renamed IsAvailable to Exists.

fatal:

  • Redesigned fatal package.
  • The Error type can be used to represent a fatal error that requires the application to terminate with context.
  • The Exiter type allows exiting the application, with different options.

progress:

  • SpinnerTracker has been moved to the spinner package. Use spinner.Tracker instead now.
  • RunParallelOptions.Concurrency is now type int instead of uint.
  • DefaultConcurrency now returns an int instead of a uint.

v0.2.0

18 Dec 03:22
c575e2e
Compare
Choose a tag to compare

New packages:

errors: The new errors package provides functionality for creating and working with errors.

  • The Error type allows for created detailed errors. These errors can be wrapped to create detailed error chains.
  • The List type allows for creating lists of errors.
  • Provides all the same functionality as the standard library errors package so this package can be used as a replacement.

progress: The new progress package provides functionality for running operations and displaying their progress.

  • Provides the Logger, Spinner, and Tracker types for displaying progress.
  • Provides the Run and RunParallel functions for running operations.

text: The new text package provides functionality for working with text.

  • The ExpandVariables and ExpandVariablesString functions can be used to expand variables in text.

Minor Changes:

color:

  • Added the Black function to create black coloured strings.
  • Refactored implementation to be faster.

file:

  • Added the Untar function to extract tar archives onto the OS filesystem.

Breaking Changes:

fatal:

  • ShowStackTraces has been renamed to PrintDetailedError.

v0.1.0

26 Jan 23:40
4006d4d
Compare
Choose a tag to compare

This marks the first proper release of goutils. We have done a major vetting and redesign of all the available APIs. This release include several breaking changes. Please note that while we now have a better of what the goutils API should be, this library is not yet stable.

Changes include:

  • Completely redesigned the spinner package. New spinner with support for progress messages and logging while the spinner is running.
  • Redesigned command package. The API is easier to use and is driven by functional options.
  • Redesigned the files package to have clearer function names.

All APIs are now properly documented with godoc. We recommend viewing the docs for details on the new APIs.

v0.0.3

18 Sep 23:41
229ef2f
Compare
Choose a tag to compare

Features:

  • Add fatal.OnExit which allows a function to be registered that will run before calling os.Exit. This is useful since defers are not called when os.Exit is called.
  • color now supports NO_COLOR. If the NO_COLOR environment variable is set, no colors will be added.
  • color now strips reset codes from any strings instead of assuming the input will always be good. This way strings with reset codes in it won't prevent the whole string from being colored.

BREAKING CHANGES:

  • fatal.ShowStackTraces is now a function that takes a bool to set whether or not stack traces are shown. Also stack traces are not shown by default now and must be explicitly enabled.

v0.0.2

30 Mar 23:01
1f6f561
Compare
Choose a tag to compare

Features:

  • Have fatal print errors with %s if ShowStackTraces = false (1f6f561)

v0.0.1

10 Feb 18:11
fe9d962
Compare
Choose a tag to compare

Initial public release.
Add the following packages:

  • color
  • command
  • fatal
  • file
  • spinner