golang

package
v0.0.0-...-7a7cedd Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CoverageManifest is the manifest filename
	CoverageManifest = "manifest.json"
	// CoverageExt is the file extension used by coverage files
	CoverageExt = ".coverage"
	// CombinedCoverage is the combined coverage report filename
	CombinedCoverage = "combined" + CoverageExt
)

Variables

View Source
var (
	// Default path to store Go coverage
	DefaultCoveragePath = filepath.Join("tmp", "coverage")
)
View Source
var (
	ErrTotalCoverageNotFound = errors.New("total coverage not found")
)

Functions

func BuildMainPackages

func BuildMainPackages(workRoot string, modPaths []string, env environment.Environment) error

BuildMainPackages builds all main packages for a list of module paths

func DownloadModules

func DownloadModules(modPaths []string, env environment.Environment) error

DownloadModules runs go mod download for all module paths passed

func GetCombinedCoverage

func GetCombinedCoverage(coverFile string, env environment.Environment) (string, error)

GetCombinedCoverage takes a coverage file and returns a string representation of percentage of statements covered

func InstallGolangCiLint

func InstallGolangCiLint(path string, env environment.Environment) error

InstallGolangCiLint runs go install for the currently supported golangci-lint version

func ParseModulesAbsPaths

func ParseModulesAbsPaths(cwd string) ([]string, error)

ParseModulesAbsPaths parses the modules listed in the go.work file from the given directory and returns a list of absolute paths to those modules

func SyncWorkspace

func SyncWorkspace(cwd string, env environment.Environment) error

SyncWorkspace runs go work sync in the given directory with a given set of environment variables

func TestWorkspace

func TestWorkspace(cwd string, modPaths []string, profileDir string, env environment.Environment, integration bool) error

TestWorkspace runs all Go tests for a given workspace. Setting integration to true will run integration tests, otherwise we only run unit tests

func TidyModules

func TidyModules(modPaths []string, env environment.Environment) error

TidyModules runs go mod tidy for all module paths passed Do not use currently, since go mod tidy is not compatible with go workspaces out of the box

func WorkspaceGenerate

func WorkspaceGenerate(modPaths []string, env environment.Environment) error

WorkspaceGenerate runs go generate ./... for all module paths passed

Types

type GoPackage

type GoPackage struct {
	Name   string `json:"name"`
	Dir    string `json:"dir"`
	Import string `json:"importpath"`
}

GoPackage represents a parsed Go package

Jump to

Keyboard shortcuts

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