Skip to content

tarcinil/go-libs

 
 

Repository files navigation

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.

About

A collection of Go libraries used across the Chef ecosystem

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 91.9%
  • Shell 8.1%