xportal

package module
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

README

xportal

Description

A portal builder inspired by caddy. It borrows a majority of code from https://github.com/caddyserver/xcaddy so credit goes to them, and this repo is under the same license due to that.

Installation


go install go.lumeweb.com/xportal/cmd/xportal@latest

Usage


xportal build --with go.lumeweb.com/portal-plugin-dashboard@latest

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Compile
	PortalVersion string        `json:"portal_version,omitempty"`
	Plugins       []Dependency  `json:"plugins,omitempty"`
	Replacements  []Replace     `json:"replacements,omitempty"`
	TimeoutGet    time.Duration `json:"timeout_get,omitempty"`
	TimeoutBuild  time.Duration `json:"timeout_build,omitempty"`
	RaceDetector  bool          `json:"race_detector,omitempty"`
	SkipCleanup   bool          `json:"skip_cleanup,omitempty"`
	SkipBuild     bool          `json:"skip_build,omitempty"`
	Debug         bool          `json:"debug,omitempty"`
	BuildFlags    string        `json:"build_flags,omitempty"`
	ModFlags      string        `json:"mod_flags,omitempty"`
	ScratchMode   bool          `json:"scratch_mode,omitempty"`
	ScratchPath   string        `json:"scratch_path,omitempty"`
}

Builder can produce a custom Port build with the configuration it represents.

func (Builder) Build

func (b Builder) Build(ctx context.Context, outputFile string) error

Build builds Port at the configured version with the configured plugins and plops down a binary at outputFile.

type Compile

type Compile struct {
	Platform
	Cgo bool `json:"cgo,omitempty"`
}

Compile contains parameters for compilation.

func SupportedPlatforms

func SupportedPlatforms() ([]Compile, error)

SupportedPlatforms runs `go tool dist list` to make a list of possible build targets.

func (Compile) CgoEnabled

func (c Compile) CgoEnabled() string

CgoEnabled returns "1" if c.Cgo is true, "0" otherwise. This is used for setting the CGO_ENABLED env variable.

type Dependency

type Dependency struct {
	// The name (import path) of the Go package. If at a version > 1,
	// it should contain semantic import version (i.e. "/v2").
	// Used with `go get`.
	PackagePath string `json:"module_path,omitempty"`

	// The version of the Go module, as used with `go get`.
	Version string `json:"version,omitempty"`
}

Dependency pairs a Go module path with a version.

func (Dependency) String

func (d Dependency) String() string

type Platform

type Platform struct {
	OS   string `json:"os,omitempty"`
	Arch string `json:"arch,omitempty"`
	ARM  string `json:"arm,omitempty"`
}

Platform represents a build target.

type Replace

type Replace struct {
	// The import path of the module being replaced.
	Old ReplacementPath `json:"old,omitempty"`

	// The path to the replacement module.
	New ReplacementPath `json:"new,omitempty"`
}

Replace represents a Go module replacement.

func NewReplace

func NewReplace(old, new string) Replace

NewReplace creates a new instance of Replace provided old and new Go module paths

type ReplacementPath

type ReplacementPath string

ReplacementPath represents an old or new path component within a Go module replacement directive.

func (ReplacementPath) Param

func (r ReplacementPath) Param() string

Param reformats a go.mod replace directive to be compatible with the `go mod edit` command.

func (ReplacementPath) String

func (r ReplacementPath) String() string

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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