constraintutil

package
v0.0.0-...-2b55090 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: Apache-2.0, MIT Imports: 7 Imported by: 9

Documentation

Overview

Package constraintutil provides utilities for working with Go build constraints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Combine

func Combine(es []constraint.Expr) constraint.Expr

Combine returns a constraint.Expr that evaluates to true iff all expressions in es evaluate to true. If es is empty, Combine returns nil.

Preconditions: All constraint.Exprs in es are non-nil.

func CombineFromFiles

func CombineFromFiles(paths []string) (constraint.Expr, error)

CombineFromFiles returns a build constraint expression that evaluates to true iff the build constraints from all of the given Go source or assembly files evaluate to true. If no build constraints apply to any of the given files, it returns nil.

func FromFile

func FromFile(path string) (constraint.Expr, error)

FromFile extracts the build constraint from the Go source or assembly file at the given path. If no build constraint applies to the file, it returns nil.

func FromReader

func FromReader(r io.Reader) (constraint.Expr, error)

FromReader extracts the build constraint from the Go source or assembly file whose contents are read by r.

func FromString

func FromString(str string) (constraint.Expr, error)

FromString extracts the build constraint from the Go source or assembly file containing the given data. If no build constraint applies to the file, it returns nil.

func Lines

func Lines(e constraint.Expr) string

Lines returns a string containing build constraint directives for the given constraint.Expr, including two trailing newlines, as appropriate for a Go source or assembly file. At least a go:build directive will be emitted; if the constraint is expressible using +build directives as well, then +build directives will also be emitted.

If e is nil, Lines returns the empty string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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