Help us shape the future of Go! Take the 2026 Go Developer Survey

common

package
v1.5.2-0...-995f177 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsIgnoreCase

func ContainsIgnoreCase(s, substr string) bool

ContainsIgnoreCase checks if string s contains substr (case-insensitive) This is a utility function used by frameworks for flexible matching

func DetermineJavaVersion

func DetermineJavaVersion(javaHome string) (int, error)

DetermineJavaVersion determines the major Java version from a Java installation by reading the JAVA_VERSION field from the release file.

Parameters:

  • javaHome: Path to the Java installation (e.g., /deps/0/jre)

Returns the major version (8, 11, 17, etc.) or an error if unable to determine.

Example:

version, err := DetermineJavaVersion("/deps/0/jre")

func GetJavaMajorVersion

func GetJavaMajorVersion() (int, error)

GetJavaMajorVersion returns the Java major version from the JAVA_HOME environment variable. This is a convenience wrapper around DetermineJavaVersion that reads JAVA_HOME from the environment.

Returns the major version (8, 11, 17, etc.) or an error if JAVA_HOME is not set or the version cannot be determined.

Example:

version, err := GetJavaMajorVersion()

Types

type Command

type Command interface {
	Execute(string, io.Writer, io.Writer, string, ...string) error
}

type Context

type Context struct {
	Stager    Stager
	Manifest  Manifest
	Installer Installer
	Log       *libbuildpack.Logger
	Command   Command
}

Context holds shared dependencies for buildpack components Used by containers, frameworks, and JREs to access buildpack infrastructure

type Installer

type Installer interface {
	InstallDependency(libbuildpack.Dependency, string) error
	InstallDependencyWithStrip(libbuildpack.Dependency, string, int) error
}

type Manifest

type Manifest interface {
	AllDependencyVersions(string) []string
	DefaultVersion(string) (libbuildpack.Dependency, error)
	GetEntry(libbuildpack.Dependency) (*libbuildpack.ManifestEntry, error)
}

type Stager

type Stager interface {
	LinkDirectoryInDepDir(string, string) error
	AddBinDependencyLink(string, string) error
	BuildDir() string
	DepDir() string
	DepsIdx() string
	CacheDir() string
	WriteConfigYml(interface{}) error
	WriteEnvFile(string, string) error
	WriteProfileD(string, string) error
}

type VCAPService

type VCAPService struct {
	Name        string                 `json:"name"`
	Label       string                 `json:"label"`
	Tags        []string               `json:"tags"`
	Credentials map[string]interface{} `json:"credentials"`
}

VCAPService represents a single Cloud Foundry service binding

func (*VCAPService) HasTag

func (s *VCAPService) HasTag(tag string) bool

HasTag checks if this service has the specified tag

type VCAPServices

type VCAPServices map[string][]VCAPService

VCAPServices represents the VCAP_SERVICES environment variable structure This is a map of service labels to arrays of service instances

func GetVCAPServices

func GetVCAPServices() (VCAPServices, error)

GetVCAPServices parses the VCAP_SERVICES environment variable Returns an empty VCAPServices map if VCAP_SERVICES is not set

func (VCAPServices) GetService

func (v VCAPServices) GetService(label string) *VCAPService

GetService returns the first service with the given label Returns nil if no service with the label exists

func (VCAPServices) GetServiceByNamePattern

func (v VCAPServices) GetServiceByNamePattern(pattern string) *VCAPService

GetServiceByNamePattern returns the first service that matches the pattern Returns nil if no matching service is found Pattern matching is case-insensitive substring matching (e.g., "newrelic" matches "my-newrelic-service") Searches across all service labels, not just "user-provided"

func (VCAPServices) HasService

func (v VCAPServices) HasService(label string) bool

HasService checks if a service with the given label exists Matching is case-insensitive to handle various service broker conventions

func (VCAPServices) HasServiceByNamePattern

func (v VCAPServices) HasServiceByNamePattern(pattern string) bool

HasServiceByNamePattern checks if any service matches the pattern Pattern matching is case-insensitive substring matching Searches across all service labels, not just "user-provided"

func (VCAPServices) HasTag

func (v VCAPServices) HasTag(tag string) bool

HasTag checks if any service has the given tag Matching is case-insensitive to handle various service broker tag conventions

type YamlHandler

type YamlHandler struct{}

YamlHandler provides a thin wrapper around yaml.v3's Marshal and Unmarshal.

func (YamlHandler) Marshal

func (h YamlHandler) Marshal(in any) ([]byte, error)

Marshal encodes the given value into YAML.

func (YamlHandler) Unmarshal

func (h YamlHandler) Unmarshal(data []byte, out any) error

Unmarshal decodes the YAML data into the provided destination.

func (YamlHandler) ValidateFields

func (h YamlHandler) ValidateFields(data []byte, out interface{}) error

ValidateFields is used to detect unknown fields during parsing of JBP_CONFIG* configurations

Jump to

Keyboard shortcuts

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