go-libs

module
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2023 License: Apache-2.0

README

go-libs

Build status Code coverage GoDoc

A collection of Go libraries used across the Chef ecosystem

featflag

An implementation to manage feature flags in Go.

Simple usage:
package main

import "github.com/chef/go-libs/featflag"

func main() {
	fmt.Printf("A global feature flag '%s' that is currently: %s",
		featflag.ChefFeatAnalyze.String(),
		featflag.ChefFeatAnalyze.Enabled(),
	)
}

Look at featflag/example for a working example.

config

An abstraction of the Chef Workstation configuration file. (config.toml)

Simple usage:
package main

import "github.com/chef/go-libs/config"

func main() {
	cfg, err := config.New()
	if err != nil {
		fmt.Println("unable to read the config", err)
	}

	fmt.Println("the log level of my config is: ", cfg.Log.Level)
}

credentials

An abstraction of the Chef credentials file. (credentials)

Simple usage:
package main

import "github.com/chef/go-libs/credentials"

func main() {
	profile := "prod"
	creds, err := credentials.New(profile)
	if err != nil {
		fmt.Println("unable to read the credentials", err)
	}

	fmt.Printf("The client_name from the '%s' profile is: %s", creds.ClientName)
}

distgen

A simple generator for creating easily distributable Go packages.

Simple usage:
package main
//go:generate go run github.com/chef/go-libs/distgen

Look at the distgen README for more examples.

Directories

Path Synopsis
An abstraction of the Chef Workstation configuration file (config.toml).
An abstraction of the Chef Workstation configuration file (config.toml).
An abstraction of the Chef credentials file (credentials).
An abstraction of the Chef credentials file (credentials).
A simple generator for creating easily distributable Go packages.
A simple generator for creating easily distributable Go packages.
An abstraction to manipulate feature flags through environment variables and a configuration file.
An abstraction to manipulate feature flags through environment variables and a configuration file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL