bump golangci-lint to v1.49.0

Motivated to have a working `make lint` on Fedora 37 (beta).
Most changes come from the new `gofmt` standards.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2022-09-30 14:25:31 +02:00
parent 45fea91a61
commit 44bac51fca
49 changed files with 397 additions and 259 deletions

View File

@ -14,6 +14,7 @@ linters:
disable: disable:
# All these break for one reason or another # All these break for one reason or another
- tagliatelle # too many JSON keys cannot be changed due to compat - tagliatelle # too many JSON keys cannot be changed due to compat
- nosnakecase # too many false positives due to the `unix` package
- gocognit - gocognit
- testpackage - testpackage
- goerr113 - goerr113

View File

@ -866,7 +866,7 @@ install.tools: .install.ginkgo .install.golangci-lint .install.swagger ## Instal
.PHONY: .install.golangci-lint .PHONY: .install.golangci-lint
.install.golangci-lint: .install.golangci-lint:
VERSION=1.46.2 ./hack/install_golangci.sh VERSION=1.49.0 ./hack/install_golangci.sh
.PHONY: .install.swagger .PHONY: .install.swagger
.install.swagger: .install.swagger:

View File

@ -50,6 +50,7 @@ func (c *Car) Color() string {
} }
// This is for reflect testing required. // This is for reflect testing required.
//
//nolint:unused //nolint:unused
func (c Car) internal() int { func (c Car) internal() int {
return 0 return 0

View File

@ -25,11 +25,13 @@ func (o OutputErrors) PrintErrors() (lastError error) {
return return
} }
/* For remote client, server does not returns error with exit code /*
instead returns a message and we cast it to a new error. For remote client, server does not returns error with exit code
Following function performs parsing on build error and returns instead returns a message and we cast it to a new error.
exit status which was expected for this current build
Following function performs parsing on build error and returns
exit status which was expected for this current build
*/ */
func ExitCodeFromBuildError(errorMsg string) (int, error) { func ExitCodeFromBuildError(errorMsg string) (int, error) {
if strings.Contains(errorMsg, "exit status") { if strings.Contains(errorMsg, "exit status") {

View File

@ -14,7 +14,8 @@ type ChoiceValue struct {
// Value may be used in cobra FlagSet methods Var/VarP/VarPF() to select from a set of values // Value may be used in cobra FlagSet methods Var/VarP/VarPF() to select from a set of values
// //
// Example: // Example:
// created := validate.ChoiceValue(&opts.Sort, "command", "created", "id", "image", "names", "runningfor", "size", "status") //
// created := validate.ChoiceValue(&opts.Sort, "command", "created", "id", "image", "names", "runningfor", "size", "status")
// flags.Var(created, "sort", "Sort output by: "+created.Choices()) // flags.Var(created, "sort", "Sort output by: "+created.Choices())
func Value(p *string, choices ...string) *ChoiceValue { func Value(p *string, choices ...string) *ChoiceValue {
return &ChoiceValue{ return &ChoiceValue{

View File

@ -166,7 +166,7 @@ func findBindMount(c *Container, containerPath string) *specs.Mount {
return nil return nil
} }
/// isPathOnMount returns true if the specified containerPath is a subdir of any // / isPathOnMount returns true if the specified containerPath is a subdir of any
// Mount's destination. // Mount's destination.
func isPathOnMount(c *Container, containerPath string) bool { func isPathOnMount(c *Container, containerPath string) bool {
cleanedContainerPath := filepath.Clean(containerPath) cleanedContainerPath := filepath.Clean(containerPath)

View File

@ -265,6 +265,7 @@ type HealthCheckLog struct {
// as possible from the spec and container config. // as possible from the spec and container config.
// Some things cannot be inferred. These will be populated by spec annotations // Some things cannot be inferred. These will be populated by spec annotations
// (if available). // (if available).
//
//nolint:revive,stylecheck // Field names are fixed for compatibility and cannot be changed. //nolint:revive,stylecheck // Field names are fixed for compatibility and cannot be changed.
type InspectContainerHostConfig struct { type InspectContainerHostConfig struct {
// Binds contains an array of user-added mounts. // Binds contains an array of user-added mounts.

View File

@ -29,7 +29,7 @@ var (
// SHMLocks is a struct enabling POSIX semaphore locking in a shared memory // SHMLocks is a struct enabling POSIX semaphore locking in a shared memory
// segment. // segment.
type SHMLocks struct { type SHMLocks struct { //nolint:revive // linter complains about stutter
lockStruct *C.shm_struct_t lockStruct *C.shm_struct_t
maxLocks uint32 maxLocks uint32
valid bool valid bool

View File

@ -16,7 +16,7 @@ import (
// The code calling the OCIRuntime will manage this. // The code calling the OCIRuntime will manage this.
// TODO: May want to move the conmon cleanup code here - it depends on // TODO: May want to move the conmon cleanup code here - it depends on
// Conmon being in use. // Conmon being in use.
type OCIRuntime interface { type OCIRuntime interface { //nolint:interfacebloat
// Name returns the name of the runtime. // Name returns the name of the runtime.
Name() string Name() string
// Path returns the path to the runtime executable. // Path returns the path to the runtime executable.

View File

@ -103,17 +103,28 @@ func (r *ConmonOCIRuntime) Attach(c *Container, params *AttachOptions) error {
return readStdio(conn, params.Streams, receiveStdoutError, stdinDone) return readStdio(conn, params.Streams, receiveStdoutError, stdinDone)
} }
// Attach to the given container's exec session // Attach to the given container's exec session.
// attachFd and startFd must be open file descriptors //
// attachFd must be the output side of the fd. attachFd is used for two things: // attachFd and startFd must be open file descriptors. attachFd must be the
// conmon will first send a nonce value across the pipe indicating it has set up its side of the console socket // output side of the fd and is used for two things:
// this ensures attachToExec gets all of the output of the called process //
// conmon will then send the exit code of the exec process, or an error in the exec session // 1. conmon will first send a nonce value across the pipe indicating it has
// set up its side of the console socket this ensures attachToExec gets all of
// the output of the called process.
//
// 2. conmon will then send the exit code of the exec process, or an error in the exec session.
//
// startFd must be the input side of the fd. // startFd must be the input side of the fd.
// newSize resizes the tty to this size before the process is started, must be nil if the exec session has no tty //
// conmon will wait to start the exec session until the parent process has set up the console socket. // newSize resizes the tty to this size before the process is started, must be
// Once attachToExec successfully attaches to the console socket, the child conmon process responsible for calling runtime exec // nil if the exec session has no tty
// will read from the output side of start fd, thus learning to start the child process. //
// conmon will wait to start the exec session until the parent process has set up the console socket.
//
// Once attachToExec successfully attaches to the console socket, the child
// conmon process responsible for calling runtime exec will read from the
// output side of start fd, thus learning to start the child process.
//
// Thus, the order goes as follow: // Thus, the order goes as follow:
// 1. conmon parent process sets up its console socket. sends on attachFd // 1. conmon parent process sets up its console socket. sends on attachFd
// 2. attachToExec attaches to the console socket after reading on attachFd and resizes the tty // 2. attachToExec attaches to the console socket after reading on attachFd and resizes the tty

View File

@ -1317,7 +1317,7 @@ func (r *ConmonOCIRuntime) sharedConmonArgs(ctr *Container, cuuid, bundlePath, p
case define.PassthroughLogging: case define.PassthroughLogging:
logDriverArg = define.PassthroughLogging logDriverArg = define.PassthroughLogging
//lint:ignore ST1015 the default case has to be here //lint:ignore ST1015 the default case has to be here
default: //nolint:stylecheck,gocritic default: //nolint:gocritic
// No case here should happen except JSONLogging, but keep this here in case the options are extended // No case here should happen except JSONLogging, but keep this here in case the options are extended
logrus.Errorf("%s logging specified but not supported. Choosing k8s-file logging instead", ctr.LogDriver()) logrus.Errorf("%s logging specified but not supported. Choosing k8s-file logging instead", ctr.LogDriver())
fallthrough fallthrough

View File

@ -74,7 +74,7 @@ type activateResponse struct {
func validatePlugin(newPlugin *VolumePlugin) error { func validatePlugin(newPlugin *VolumePlugin) error {
// It's a socket. Is it a plugin? // It's a socket. Is it a plugin?
// Hit the Activate endpoint to find out if it is, and if so what kind // Hit the Activate endpoint to find out if it is, and if so what kind
req, err := http.NewRequest("POST", "http://plugin"+activatePath, nil) req, err := http.NewRequest(http.MethodPost, "http://plugin"+activatePath, nil)
if err != nil { if err != nil {
return fmt.Errorf("making request to volume plugin %s activation endpoint: %w", newPlugin.Name, err) return fmt.Errorf("making request to volume plugin %s activation endpoint: %w", newPlugin.Name, err)
} }
@ -90,7 +90,7 @@ func validatePlugin(newPlugin *VolumePlugin) error {
// Response code MUST be 200. Anything else, we have to assume it's not // Response code MUST be 200. Anything else, we have to assume it's not
// a valid plugin. // a valid plugin.
if resp.StatusCode != 200 { if resp.StatusCode != http.StatusOK {
return fmt.Errorf("got status code %d from activation endpoint for plugin %s: %w", resp.StatusCode, newPlugin.Name, ErrNotPlugin) return fmt.Errorf("got status code %d from activation endpoint for plugin %s: %w", resp.StatusCode, newPlugin.Name, ErrNotPlugin)
} }
@ -216,7 +216,7 @@ func (p *VolumePlugin) sendRequest(toJSON interface{}, endpoint string) (*http.R
} }
} }
req, err := http.NewRequest("POST", "http://plugin"+endpoint, bytes.NewReader(reqJSON)) req, err := http.NewRequest(http.MethodPost, "http://plugin"+endpoint, bytes.NewReader(reqJSON))
if err != nil { if err != nil {
return nil, fmt.Errorf("making request to volume plugin %s endpoint %s: %w", p.Name, endpoint, err) return nil, fmt.Errorf("making request to volume plugin %s endpoint %s: %w", p.Name, endpoint, err)
} }
@ -251,7 +251,7 @@ func (p *VolumePlugin) handleErrorResponse(resp *http.Response, endpoint, volNam
// errors, but I don't think we can guarantee all plugins do that. // errors, but I don't think we can guarantee all plugins do that.
// Let's interpret anything other than 200 as an error. // Let's interpret anything other than 200 as an error.
// If there isn't an error, don't even bother decoding the response. // If there isn't an error, don't even bother decoding the response.
if resp.StatusCode != 200 { if resp.StatusCode != http.StatusOK {
errResp, err := io.ReadAll(resp.Body) errResp, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return fmt.Errorf("reading response body from volume plugin %s: %w", p.Name, err) return fmt.Errorf("reading response body from volume plugin %s: %w", p.Name, err)

View File

@ -15,7 +15,7 @@ import "github.com/containers/common/libnetwork/types"
// retrieved after they are pulled from the database. // retrieved after they are pulled from the database.
// Generally speaking, the syncContainer() call should be run at the beginning // Generally speaking, the syncContainer() call should be run at the beginning
// of all API operations, which will silently handle this. // of all API operations, which will silently handle this.
type State interface { type State interface { //nolint:interfacebloat
// Close performs any pre-exit cleanup (e.g. closing database // Close performs any pre-exit cleanup (e.g. closing database
// connections) that may be required // connections) that may be required
Close() error Close() error

View File

@ -29,7 +29,8 @@ func NewAPIDecoder() *schema.Decoder {
} }
// On client: // On client:
// v := map[string][]string{ //
// v := map[string][]string{
// "dangling": {"true"}, // "dangling": {"true"},
// } // }
// //

View File

@ -1,17 +1,15 @@
// Package swagger defines the payloads used by the Podman API // Package swagger defines the payloads used by the Podman API
// //
// - errors.go: declares the errors used in the API. By embedding errors.ErrorModel, more meaningful // - errors.go: declares the errors used in the API. By embedding errors.ErrorModel, more meaningful
// comments can be provided for the developer documentation. // comments can be provided for the developer documentation.
// - models.go: declares the models used in API requests. // - models.go: declares the models used in API requests.
// - responses.go: declares the responses used in the API responses. // - responses.go: declares the responses used in the API responses.
//
// //
// Notes: // Notes:
// 1. As a developer of the Podman API, you are responsible for maintaining the associations between // 1. As a developer of the Podman API, you are responsible for maintaining the associations between
// these models and responses, and the handler code. // these models and responses, and the handler code.
// 2. There are a number of warnings produces when compiling the swagger yaml file. This is expected. // 2. There are a number of warnings produces when compiling the swagger yaml file. This is expected.
// Most are because embedded structs have been discovered but not used in the API declarations. // Most are because embedded structs have been discovered but not used in the API declarations.
// 3. Response and model references that are exported (start with upper-case letter) imply that they // 3. Response and model references that are exported (start with upper-case letter) imply that they
// exist outside this package and should be found in the entities package. // exist outside this package and should be found in the entities package.
//
package swagger package swagger

View File

@ -69,7 +69,7 @@ func WaitContainerDocker(w http.ResponseWriter, r *http.Request) {
// In docker compatibility mode we have to send headers in advance, // In docker compatibility mode we have to send headers in advance,
// otherwise docker client would freeze. // otherwise docker client would freeze.
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
w.WriteHeader(200) w.WriteHeader(http.StatusOK)
if flusher, ok := w.(http.Flusher); ok { if flusher, ok := w.(http.Flusher); ok {
flusher.Flush() flusher.Flush()
} }

View File

@ -12,7 +12,7 @@ import (
) )
func TestSupportedVersion(t *testing.T) { func TestSupportedVersion(t *testing.T) {
req, err := http.NewRequest("GET", req, err := http.NewRequest(http.MethodGet,
fmt.Sprintf("/v%s/libpod/testing/versions", version.APIVersion[version.Libpod][version.CurrentAPI]), fmt.Sprintf("/v%s/libpod/testing/versions", version.APIVersion[version.Libpod][version.CurrentAPI]),
nil) nil)
if err != nil { if err != nil {
@ -55,7 +55,7 @@ func TestSupportedVersion(t *testing.T) {
func TestUnsupportedVersion(t *testing.T) { func TestUnsupportedVersion(t *testing.T) {
version := "999.999.999" version := "999.999.999"
req, err := http.NewRequest("GET", req, err := http.NewRequest(http.MethodGet,
fmt.Sprintf("/v%s/libpod/testing/versions", version), fmt.Sprintf("/v%s/libpod/testing/versions", version),
nil) nil)
if err != nil { if err != nil {
@ -98,7 +98,7 @@ func TestUnsupportedVersion(t *testing.T) {
func TestEqualVersion(t *testing.T) { func TestEqualVersion(t *testing.T) {
version := "1.30.0" version := "1.30.0"
req, err := http.NewRequest("GET", req, err := http.NewRequest(http.MethodGet,
fmt.Sprintf("/v%s/libpod/testing/versions", version), fmt.Sprintf("/v%s/libpod/testing/versions", version),
nil) nil)
if err != nil { if err != nil {

View File

@ -5,7 +5,7 @@
// //
// To start the service and keep it running for 5,000 seconds (-t 0 runs forever): // To start the service and keep it running for 5,000 seconds (-t 0 runs forever):
// //
// podman system service -t 5000 & // podman system service -t 5000 &
// //
// You can then use cURL on the socket using requests documented below. // You can then use cURL on the socket using requests documented below.
// //
@ -23,44 +23,44 @@
// //
// See podman-service(1) for more information. // See podman-service(1) for more information.
// //
// Quick Examples: // Quick Examples:
// //
// 'podman info' // 'podman info'
// //
// curl --unix-socket /run/podman/podman.sock http://d/v4.0.0/libpod/info // curl --unix-socket /run/podman/podman.sock http://d/v4.0.0/libpod/info
// //
// 'podman pull quay.io/containers/podman' // 'podman pull quay.io/containers/podman'
// //
// curl -XPOST --unix-socket /run/podman/podman.sock -v 'http://d/v4.0.0/images/create?fromImage=quay.io%2Fcontainers%2Fpodman' // curl -XPOST --unix-socket /run/podman/podman.sock -v 'http://d/v4.0.0/images/create?fromImage=quay.io%2Fcontainers%2Fpodman'
// //
// 'podman list images' // 'podman list images'
// //
// curl --unix-socket /run/podman/podman.sock -v 'http://d/v4.0.0/libpod/images/json' | jq // curl --unix-socket /run/podman/podman.sock -v 'http://d/v4.0.0/libpod/images/json' | jq
// //
// Terms Of Service: // Terms Of Service:
// //
// https://github.com/containers/podman/blob/913caaa9b1de2b63692c9bae15120208194c9eb3/LICENSE // https://github.com/containers/podman/blob/913caaa9b1de2b63692c9bae15120208194c9eb3/LICENSE
// //
// Schemes: http, https // Schemes: http, https
// Host: podman.io // Host: podman.io
// BasePath: / // BasePath: /
// Version: 4.0.0 // Version: 4.0.0
// License: Apache-2.0 https://opensource.org/licenses/Apache-2.0 // License: Apache-2.0 https://opensource.org/licenses/Apache-2.0
// Contact: Podman <podman@lists.podman.io> https://podman.io/community/ // Contact: Podman <podman@lists.podman.io> https://podman.io/community/
// //
// InfoExtensions: // InfoExtensions:
// x-logo: // x-logo:
// - url: https://raw.githubusercontent.com/containers/libpod/main/logo/podman-logo.png // - url: https://raw.githubusercontent.com/containers/libpod/main/logo/podman-logo.png
// - altText: "Podman logo" // - altText: "Podman logo"
// //
// Produces: // Produces:
// - application/json // - application/json
// - application/octet-stream // - application/octet-stream
// - text/plain // - text/plain
// //
// Consumes: // Consumes:
// - application/json // - application/json
// - application/x-tar // - application/x-tar
// //
// swagger:meta // swagger:meta
package server package server

View File

@ -32,10 +32,10 @@ func NewTracker(idle time.Duration) *Tracker {
} }
// ConnState is called on HTTP connection state changes. // ConnState is called on HTTP connection state changes.
// - Once StateHijacked, StateClose is _NOT_ called on that connection // - Once StateHijacked, StateClose is _NOT_ called on that connection
// - There are two "idle" timeouts, the http idle connection (not to be confused with the TCP/IP idle socket timeout) // - There are two "idle" timeouts, the http idle connection (not to be confused with the TCP/IP idle socket timeout)
// and the API idle window. The caller should set the http idle timeout to 2x the time provided to NewTacker() which // and the API idle window. The caller should set the http idle timeout to 2x the time provided to NewTacker() which
// is the API idle window. // is the API idle window.
func (t *Tracker) ConnState(conn net.Conn, state http.ConnState) { func (t *Tracker) ConnState(conn net.Conn, state http.ConnState) {
t.mux.Lock() t.mux.Lock()
defer t.mux.Unlock() defer t.mux.Unlock()

View File

@ -8,7 +8,8 @@ import (
) )
// ListenUnix follows stdlib net.Listen() API, providing a unix listener for given path // ListenUnix follows stdlib net.Listen() API, providing a unix listener for given path
// ListenUnix will delete and create files/directories as needed //
// ListenUnix will delete and create files/directories as needed
func ListenUnix(network string, path string) (net.Listener, error) { func ListenUnix(network string, path string) (net.Listener, error) {
// set up custom listener for API server // set up custom listener for API server
err := os.MkdirAll(filepath.Dir(path), 0770) err := os.MkdirAll(filepath.Dir(path), 0770)

View File

@ -92,7 +92,7 @@ func LookupPolicy(s string) (Policy, error) {
return "", fmt.Errorf("invalid auto-update policy %q: valid policies are %+q", s, keys) return "", fmt.Errorf("invalid auto-update policy %q: valid policies are %+q", s, keys)
} }
/// AutoUpdate looks up containers with a specified auto-update policy and acts // / AutoUpdate looks up containers with a specified auto-update policy and acts
// accordingly. // accordingly.
// //
// If the policy is set to PolicyRegistryImage, it checks if the image // If the policy is set to PolicyRegistryImage, it checks if the image

View File

@ -7,9 +7,10 @@ import (
"github.com/containers/podman/v4/libpod/define" "github.com/containers/podman/v4/libpod/define"
) )
//go:generate go run ../generator/generator.go LogOptions
// LogOptions describe finer control of log content or // LogOptions describe finer control of log content or
// how the content is formatted. // how the content is formatted.
//
//go:generate go run ../generator/generator.go LogOptions
type LogOptions struct { type LogOptions struct {
Follow *bool Follow *bool
Since *string Since *string
@ -20,10 +21,11 @@ type LogOptions struct {
Until *string Until *string
} }
//go:generate go run ../generator/generator.go CommitOptions
// CommitOptions describe details about the resulting committed // CommitOptions describe details about the resulting committed
// image as defined by repo and tag. None of these options // image as defined by repo and tag. None of these options
// are required. // are required.
//
//go:generate go run ../generator/generator.go CommitOptions
type CommitOptions struct { type CommitOptions struct {
Author *string Author *string
Changes []string Changes []string
@ -35,16 +37,18 @@ type CommitOptions struct {
Tag *string Tag *string
} }
//go:generate go run ../generator/generator.go AttachOptions
// AttachOptions are optional options for attaching to containers // AttachOptions are optional options for attaching to containers
//
//go:generate go run ../generator/generator.go AttachOptions
type AttachOptions struct { type AttachOptions struct {
DetachKeys *string // Keys to detach from running container DetachKeys *string // Keys to detach from running container
Logs *bool // Flag to return all logs from container when true Logs *bool // Flag to return all logs from container when true
Stream *bool // Flag only return container logs when false and Logs is true Stream *bool // Flag only return container logs when false and Logs is true
} }
//go:generate go run ../generator/generator.go CheckpointOptions
// CheckpointOptions are optional options for checkpointing containers // CheckpointOptions are optional options for checkpointing containers
//
//go:generate go run ../generator/generator.go CheckpointOptions
type CheckpointOptions struct { type CheckpointOptions struct {
Export *string Export *string
CreateImage *string CreateImage *string
@ -58,8 +62,9 @@ type CheckpointOptions struct {
FileLocks *bool FileLocks *bool
} }
//go:generate go run ../generator/generator.go RestoreOptions
// RestoreOptions are optional options for restoring containers // RestoreOptions are optional options for restoring containers
//
//go:generate go run ../generator/generator.go RestoreOptions
type RestoreOptions struct { type RestoreOptions struct {
IgnoreRootfs *bool IgnoreRootfs *bool
IgnoreVolumes *bool IgnoreVolumes *bool
@ -82,12 +87,14 @@ type RestoreOptions struct {
FileLocks *bool FileLocks *bool
} }
//go:generate go run ../generator/generator.go CreateOptions
// CreateOptions are optional options for creating containers // CreateOptions are optional options for creating containers
//
//go:generate go run ../generator/generator.go CreateOptions
type CreateOptions struct{} type CreateOptions struct{}
//go:generate go run ../generator/generator.go DiffOptions
// DiffOptions are optional options for creating containers // DiffOptions are optional options for creating containers
//
//go:generate go run ../generator/generator.go DiffOptions
type DiffOptions struct { type DiffOptions struct {
// By the default diff will compare against the parent layer. Change the Parent if you want to compare against something else. // By the default diff will compare against the parent layer. Change the Parent if you want to compare against something else.
Parent *string Parent *string
@ -95,39 +102,46 @@ type DiffOptions struct {
DiffType *string DiffType *string
} }
//go:generate go run ../generator/generator.go ExecInspectOptions
// ExecInspectOptions are optional options for inspecting // ExecInspectOptions are optional options for inspecting
// exec sessions // exec sessions
//
//go:generate go run ../generator/generator.go ExecInspectOptions
type ExecInspectOptions struct{} type ExecInspectOptions struct{}
//go:generate go run ../generator/generator.go ExecStartOptions
// ExecStartOptions are optional options for starting // ExecStartOptions are optional options for starting
// exec sessions // exec sessions
//
//go:generate go run ../generator/generator.go ExecStartOptions
type ExecStartOptions struct { type ExecStartOptions struct {
} }
//go:generate go run ../generator/generator.go HealthCheckOptions
// HealthCheckOptions are optional options for checking // HealthCheckOptions are optional options for checking
// the health of a container // the health of a container
//
//go:generate go run ../generator/generator.go HealthCheckOptions
type HealthCheckOptions struct{} type HealthCheckOptions struct{}
//go:generate go run ../generator/generator.go MountOptions
// MountOptions are optional options for mounting // MountOptions are optional options for mounting
// containers // containers
//
//go:generate go run ../generator/generator.go MountOptions
type MountOptions struct{} type MountOptions struct{}
//go:generate go run ../generator/generator.go UnmountOptions
// UnmountOptions are optional options for unmounting // UnmountOptions are optional options for unmounting
// containers // containers
//
//go:generate go run ../generator/generator.go UnmountOptions
type UnmountOptions struct{} type UnmountOptions struct{}
//go:generate go run ../generator/generator.go MountedContainerPathsOptions
// MountedContainerPathsOptions are optional options for getting // MountedContainerPathsOptions are optional options for getting
// container mount paths // container mount paths
//
//go:generate go run ../generator/generator.go MountedContainerPathsOptions
type MountedContainerPathsOptions struct{} type MountedContainerPathsOptions struct{}
//go:generate go run ../generator/generator.go ListOptions
// ListOptions are optional options for listing containers // ListOptions are optional options for listing containers
//
//go:generate go run ../generator/generator.go ListOptions
type ListOptions struct { type ListOptions struct {
All *bool All *bool
External *bool External *bool
@ -138,14 +152,16 @@ type ListOptions struct {
Sync *bool Sync *bool
} }
//go:generate go run ../generator/generator.go PruneOptions
// PruneOptions are optional options for pruning containers // PruneOptions are optional options for pruning containers
//
//go:generate go run ../generator/generator.go PruneOptions
type PruneOptions struct { type PruneOptions struct {
Filters map[string][]string Filters map[string][]string
} }
//go:generate go run ../generator/generator.go RemoveOptions
// RemoveOptions are optional options for removing containers // RemoveOptions are optional options for removing containers
//
//go:generate go run ../generator/generator.go RemoveOptions
type RemoveOptions struct { type RemoveOptions struct {
Depend *bool Depend *bool
Ignore *bool Ignore *bool
@ -154,106 +170,123 @@ type RemoveOptions struct {
Timeout *uint Timeout *uint
} }
//go:generate go run ../generator/generator.go InspectOptions
// InspectOptions are optional options for inspecting containers // InspectOptions are optional options for inspecting containers
//
//go:generate go run ../generator/generator.go InspectOptions
type InspectOptions struct { type InspectOptions struct {
Size *bool Size *bool
} }
//go:generate go run ../generator/generator.go KillOptions
// KillOptions are optional options for killing containers // KillOptions are optional options for killing containers
//
//go:generate go run ../generator/generator.go KillOptions
type KillOptions struct { type KillOptions struct {
Signal *string Signal *string
} }
//go:generate go run ../generator/generator.go PauseOptions
// PauseOptions are optional options for pausing containers // PauseOptions are optional options for pausing containers
//
//go:generate go run ../generator/generator.go PauseOptions
type PauseOptions struct{} type PauseOptions struct{}
//go:generate go run ../generator/generator.go RestartOptions
// RestartOptions are optional options for restarting containers // RestartOptions are optional options for restarting containers
//
//go:generate go run ../generator/generator.go RestartOptions
type RestartOptions struct { type RestartOptions struct {
Timeout *int Timeout *int
} }
//go:generate go run ../generator/generator.go StartOptions
// StartOptions are optional options for starting containers // StartOptions are optional options for starting containers
//
//go:generate go run ../generator/generator.go StartOptions
type StartOptions struct { type StartOptions struct {
DetachKeys *string DetachKeys *string
Recursive *bool Recursive *bool
} }
//go:generate go run ../generator/generator.go StatsOptions
// StatsOptions are optional options for getting stats on containers // StatsOptions are optional options for getting stats on containers
//
//go:generate go run ../generator/generator.go StatsOptions
type StatsOptions struct { type StatsOptions struct {
Stream *bool Stream *bool
Interval *int Interval *int
} }
//go:generate go run ../generator/generator.go TopOptions
// TopOptions are optional options for getting running // TopOptions are optional options for getting running
// processes in containers // processes in containers
//
//go:generate go run ../generator/generator.go TopOptions
type TopOptions struct { type TopOptions struct {
Descriptors *[]string Descriptors *[]string
} }
//go:generate go run ../generator/generator.go UnpauseOptions
// UnpauseOptions are optional options for unpausing containers // UnpauseOptions are optional options for unpausing containers
//
//go:generate go run ../generator/generator.go UnpauseOptions
type UnpauseOptions struct{} type UnpauseOptions struct{}
//go:generate go run ../generator/generator.go WaitOptions
// WaitOptions are optional options for waiting on containers // WaitOptions are optional options for waiting on containers
//
//go:generate go run ../generator/generator.go WaitOptions
type WaitOptions struct { type WaitOptions struct {
Condition []define.ContainerStatus Condition []define.ContainerStatus
Interval *string Interval *string
} }
//go:generate go run ../generator/generator.go StopOptions
// StopOptions are optional options for stopping containers // StopOptions are optional options for stopping containers
//
//go:generate go run ../generator/generator.go StopOptions
type StopOptions struct { type StopOptions struct {
Ignore *bool Ignore *bool
Timeout *uint Timeout *uint
} }
//go:generate go run ../generator/generator.go ExportOptions
// ExportOptions are optional options for exporting containers // ExportOptions are optional options for exporting containers
//
//go:generate go run ../generator/generator.go ExportOptions
type ExportOptions struct{} type ExportOptions struct{}
//go:generate go run ../generator/generator.go InitOptions
// InitOptions are optional options for initing containers // InitOptions are optional options for initing containers
//
//go:generate go run ../generator/generator.go InitOptions
type InitOptions struct{} type InitOptions struct{}
//go:generate go run ../generator/generator.go ShouldRestartOptions
// ShouldRestartOptions // ShouldRestartOptions
//
//go:generate go run ../generator/generator.go ShouldRestartOptions
type ShouldRestartOptions struct{} type ShouldRestartOptions struct{}
//go:generate go run ../generator/generator.go RenameOptions
// RenameOptions are options for renaming containers. // RenameOptions are options for renaming containers.
// The Name field is required. // The Name field is required.
//
//go:generate go run ../generator/generator.go RenameOptions
type RenameOptions struct { type RenameOptions struct {
Name *string Name *string
} }
//go:generate go run ../generator/generator.go ResizeTTYOptions
// ResizeTTYOptions are optional options for resizing // ResizeTTYOptions are optional options for resizing
// container TTYs // container TTYs
//
//go:generate go run ../generator/generator.go ResizeTTYOptions
type ResizeTTYOptions struct { type ResizeTTYOptions struct {
Height *int Height *int
Width *int Width *int
Running *bool Running *bool
} }
//go:generate go run ../generator/generator.go ResizeExecTTYOptions
// ResizeExecTTYOptions are optional options for resizing // ResizeExecTTYOptions are optional options for resizing
// container ExecTTYs // container ExecTTYs
//
//go:generate go run ../generator/generator.go ResizeExecTTYOptions
type ResizeExecTTYOptions struct { type ResizeExecTTYOptions struct {
Height *int Height *int
Width *int Width *int
} }
//go:generate go run ../generator/generator.go ExecStartAndAttachOptions
// ExecStartAndAttachOptions are optional options for resizing // ExecStartAndAttachOptions are optional options for resizing
// container ExecTTYs // container ExecTTYs
//
//go:generate go run ../generator/generator.go ExecStartAndAttachOptions
type ExecStartAndAttachOptions struct { type ExecStartAndAttachOptions struct {
// OutputStream will be attached to container's STDOUT // OutputStream will be attached to container's STDOUT
OutputStream *io.WriteCloser OutputStream *io.WriteCloser
@ -272,15 +305,17 @@ type ExecStartAndAttachOptions struct {
AttachInput *bool AttachInput *bool
} }
//go:generate go run ../generator/generator.go ExistsOptions
// ExistsOptions are optional options for checking if a container exists // ExistsOptions are optional options for checking if a container exists
//
//go:generate go run ../generator/generator.go ExistsOptions
type ExistsOptions struct { type ExistsOptions struct {
// External checks for containers created outside of Podman // External checks for containers created outside of Podman
External *bool External *bool
} }
//go:generate go run ../generator/generator.go CopyOptions
// CopyOptions are options for copying to containers. // CopyOptions are options for copying to containers.
//
//go:generate go run ../generator/generator.go CopyOptions
type CopyOptions struct { type CopyOptions struct {
// If used with CopyFromArchive and set to true it will change ownership of files from the source tar archive // If used with CopyFromArchive and set to true it will change ownership of files from the source tar archive
// to the primary uid/gid of the target container. // to the primary uid/gid of the target container.

View File

@ -1,14 +1,16 @@
package generate package generate
//go:generate go run ../generator/generator.go KubeOptions
// KubeOptions are optional options for generating kube YAML files // KubeOptions are optional options for generating kube YAML files
//
//go:generate go run ../generator/generator.go KubeOptions
type KubeOptions struct { type KubeOptions struct {
// Service - generate YAML for a Kubernetes _service_ object. // Service - generate YAML for a Kubernetes _service_ object.
Service *bool Service *bool
} }
//go:generate go run ../generator/generator.go SystemdOptions
// SystemdOptions are optional options for generating systemd files // SystemdOptions are optional options for generating systemd files
//
//go:generate go run ../generator/generator.go SystemdOptions
type SystemdOptions struct { type SystemdOptions struct {
// Name - use container/pod name instead of its ID. // Name - use container/pod name instead of its ID.
UseName *bool UseName *bool

View File

@ -6,8 +6,9 @@ import (
buildahDefine "github.com/containers/buildah/define" buildahDefine "github.com/containers/buildah/define"
) )
//go:generate go run ../generator/generator.go RemoveOptions
// RemoveOptions are optional options for image removal // RemoveOptions are optional options for image removal
//
//go:generate go run ../generator/generator.go RemoveOptions
type RemoveOptions struct { type RemoveOptions struct {
// All removes all images // All removes all images
All *bool All *bool
@ -21,8 +22,9 @@ type RemoveOptions struct {
NoPrune *bool NoPrune *bool
} }
//go:generate go run ../generator/generator.go DiffOptions
// DiffOptions are optional options image diffs // DiffOptions are optional options image diffs
//
//go:generate go run ../generator/generator.go DiffOptions
type DiffOptions struct { type DiffOptions struct {
// By the default diff will compare against the parent layer. Change the Parent if you want to compare against something else. // By the default diff will compare against the parent layer. Change the Parent if you want to compare against something else.
Parent *string Parent *string
@ -30,8 +32,9 @@ type DiffOptions struct {
DiffType *string DiffType *string
} }
//go:generate go run ../generator/generator.go ListOptions
// ListOptions are optional options for listing images // ListOptions are optional options for listing images
//
//go:generate go run ../generator/generator.go ListOptions
type ListOptions struct { type ListOptions struct {
// All lists all image in the image store including dangling images // All lists all image in the image store including dangling images
All *bool All *bool
@ -39,35 +42,40 @@ type ListOptions struct {
Filters map[string][]string Filters map[string][]string
} }
//go:generate go run ../generator/generator.go GetOptions
// GetOptions are optional options for inspecting an image // GetOptions are optional options for inspecting an image
//
//go:generate go run ../generator/generator.go GetOptions
type GetOptions struct { type GetOptions struct {
// Size computes the amount of storage the image consumes // Size computes the amount of storage the image consumes
Size *bool Size *bool
} }
//go:generate go run ../generator/generator.go TreeOptions
// TreeOptions are optional options for a tree-based representation // TreeOptions are optional options for a tree-based representation
// of the image // of the image
//
//go:generate go run ../generator/generator.go TreeOptions
type TreeOptions struct { type TreeOptions struct {
// WhatRequires ... // WhatRequires ...
WhatRequires *bool WhatRequires *bool
} }
//go:generate go run ../generator/generator.go HistoryOptions
// HistoryOptions are optional options image history // HistoryOptions are optional options image history
//
//go:generate go run ../generator/generator.go HistoryOptions
type HistoryOptions struct { type HistoryOptions struct {
} }
//go:generate go run ../generator/generator.go LoadOptions
// LoadOptions are optional options for loading an image // LoadOptions are optional options for loading an image
//
//go:generate go run ../generator/generator.go LoadOptions
type LoadOptions struct { type LoadOptions struct {
// Reference is the name of the loaded image // Reference is the name of the loaded image
Reference *string Reference *string
} }
//go:generate go run ../generator/generator.go ExportOptions
// ExportOptions are optional options for exporting images // ExportOptions are optional options for exporting images
//
//go:generate go run ../generator/generator.go ExportOptions
type ExportOptions struct { type ExportOptions struct {
// Compress the image // Compress the image
Compress *bool Compress *bool
@ -77,8 +85,9 @@ type ExportOptions struct {
OciAcceptUncompressedLayers *bool OciAcceptUncompressedLayers *bool
} }
//go:generate go run ../generator/generator.go PruneOptions
// PruneOptions are optional options for pruning images // PruneOptions are optional options for pruning images
//
//go:generate go run ../generator/generator.go PruneOptions
type PruneOptions struct { type PruneOptions struct {
// Prune all images // Prune all images
All *bool All *bool
@ -88,18 +97,21 @@ type PruneOptions struct {
Filters map[string][]string Filters map[string][]string
} }
//go:generate go run ../generator/generator.go TagOptions
// TagOptions are optional options for tagging images // TagOptions are optional options for tagging images
//
//go:generate go run ../generator/generator.go TagOptions
type TagOptions struct { type TagOptions struct {
} }
//go:generate go run ../generator/generator.go UntagOptions
// UntagOptions are optional options for untagging images // UntagOptions are optional options for untagging images
//
//go:generate go run ../generator/generator.go UntagOptions
type UntagOptions struct { type UntagOptions struct {
} }
//go:generate go run ../generator/generator.go ImportOptions
// ImportOptions are optional options for importing images // ImportOptions are optional options for importing images
//
//go:generate go run ../generator/generator.go ImportOptions
type ImportOptions struct { type ImportOptions struct {
// Changes to be applied to the image // Changes to be applied to the image
Changes *[]string Changes *[]string
@ -117,8 +129,9 @@ type ImportOptions struct {
Variant *string Variant *string
} }
//go:generate go run ../generator/generator.go PushOptions
// PushOptions are optional options for importing images // PushOptions are optional options for importing images
//
//go:generate go run ../generator/generator.go PushOptions
type PushOptions struct { type PushOptions struct {
// All indicates whether to push all images related to the image list // All indicates whether to push all images related to the image list
All *bool All *bool
@ -147,8 +160,9 @@ type PushOptions struct {
Quiet *bool Quiet *bool
} }
//go:generate go run ../generator/generator.go SearchOptions
// SearchOptions are optional options for searching images on registries // SearchOptions are optional options for searching images on registries
//
//go:generate go run ../generator/generator.go SearchOptions
type SearchOptions struct { type SearchOptions struct {
// Authfile is the path to the authentication file. Ignored for remote // Authfile is the path to the authentication file. Ignored for remote
// calls. // calls.
@ -163,8 +177,9 @@ type SearchOptions struct {
ListTags *bool ListTags *bool
} }
//go:generate go run ../generator/generator.go PullOptions
// PullOptions are optional options for pulling images // PullOptions are optional options for pulling images
//
//go:generate go run ../generator/generator.go PullOptions
type PullOptions struct { type PullOptions struct {
// AllTags can be specified to pull all tags of an image. Note // AllTags can be specified to pull all tags of an image. Note
// that this only works if the image does not include a tag. // that this only works if the image does not include a tag.
@ -200,8 +215,9 @@ type BuildOptions struct {
buildahDefine.BuildOptions buildahDefine.BuildOptions
} }
//go:generate go run ../generator/generator.go ExistsOptions
// ExistsOptions are optional options for checking if an image exists // ExistsOptions are optional options for checking if an image exists
//
//go:generate go run ../generator/generator.go ExistsOptions
type ExistsOptions struct { type ExistsOptions struct {
} }

View File

@ -4,8 +4,9 @@ import (
"net" "net"
) )
//go:generate go run ../generator/generator.go PlayOptions
// PlayOptions are optional options for replaying kube YAML files // PlayOptions are optional options for replaying kube YAML files
//
//go:generate go run ../generator/generator.go PlayOptions
type PlayOptions struct { type PlayOptions struct {
// Annotations - Annotations to add to Pods // Annotations - Annotations to add to Pods
Annotations map[string]string Annotations map[string]string

View File

@ -1,25 +1,29 @@
package manifests package manifests
//go:generate go run ../generator/generator.go InspectOptions
// InspectOptions are optional options for inspecting manifests // InspectOptions are optional options for inspecting manifests
//
//go:generate go run ../generator/generator.go InspectOptions
type InspectOptions struct { type InspectOptions struct {
} }
//go:generate go run ../generator/generator.go CreateOptions
// CreateOptions are optional options for creating manifests // CreateOptions are optional options for creating manifests
//
//go:generate go run ../generator/generator.go CreateOptions
type CreateOptions struct { type CreateOptions struct {
All *bool All *bool
Amend *bool Amend *bool
} }
//go:generate go run ../generator/generator.go ExistsOptions
// ExistsOptions are optional options for checking // ExistsOptions are optional options for checking
// if a manifest list exists // if a manifest list exists
//
//go:generate go run ../generator/generator.go ExistsOptions
type ExistsOptions struct { type ExistsOptions struct {
} }
//go:generate go run ../generator/generator.go AddOptions
// AddOptions are optional options for adding manifest lists // AddOptions are optional options for adding manifest lists
//
//go:generate go run ../generator/generator.go AddOptions
type AddOptions struct { type AddOptions struct {
All *bool All *bool
Annotation map[string]string Annotation map[string]string
@ -35,13 +39,15 @@ type AddOptions struct {
SkipTLSVerify *bool `schema:"-"` SkipTLSVerify *bool `schema:"-"`
} }
//go:generate go run ../generator/generator.go RemoveOptions
// RemoveOptions are optional options for removing manifest lists // RemoveOptions are optional options for removing manifest lists
//
//go:generate go run ../generator/generator.go RemoveOptions
type RemoveOptions struct { type RemoveOptions struct {
} }
//go:generate go run ../generator/generator.go ModifyOptions
// ModifyOptions are optional options for modifying manifest lists // ModifyOptions are optional options for modifying manifest lists
//
//go:generate go run ../generator/generator.go ModifyOptions
type ModifyOptions struct { type ModifyOptions struct {
// Operation values are "update", "remove" and "annotate". This allows the service to // Operation values are "update", "remove" and "annotate". This allows the service to
// efficiently perform each update on a manifest list. // efficiently perform each update on a manifest list.

View File

@ -4,8 +4,9 @@ import (
"net" "net"
) )
//go:generate go run ../generator/generator.go CreateOptions
// CreateOptions are optional options for creating networks // CreateOptions are optional options for creating networks
//
//go:generate go run ../generator/generator.go CreateOptions
type CreateOptions struct { type CreateOptions struct {
// DisableDNS turns off use of DNSMasq for name resolution // DisableDNS turns off use of DNSMasq for name resolution
// on the network // on the network
@ -33,45 +34,51 @@ type CreateOptions struct {
Name *string Name *string
} }
//go:generate go run ../generator/generator.go InspectOptions
// InspectOptions are optional options for inspecting networks // InspectOptions are optional options for inspecting networks
//
//go:generate go run ../generator/generator.go InspectOptions
type InspectOptions struct { type InspectOptions struct {
} }
//go:generate go run ../generator/generator.go RemoveOptions
// RemoveOptions are optional options for inspecting networks // RemoveOptions are optional options for inspecting networks
//
//go:generate go run ../generator/generator.go RemoveOptions
type RemoveOptions struct { type RemoveOptions struct {
// Force removes the network even if it is being used // Force removes the network even if it is being used
Force *bool Force *bool
Timeout *uint Timeout *uint
} }
//go:generate go run ../generator/generator.go ListOptions
// ListOptions are optional options for listing networks // ListOptions are optional options for listing networks
//
//go:generate go run ../generator/generator.go ListOptions
type ListOptions struct { type ListOptions struct {
// Filters are applied to the list of networks to be more // Filters are applied to the list of networks to be more
// specific on the output // specific on the output
Filters map[string][]string Filters map[string][]string
} }
//go:generate go run ../generator/generator.go DisconnectOptions
// DisconnectOptions are optional options for disconnecting // DisconnectOptions are optional options for disconnecting
// containers from a network // containers from a network
//
//go:generate go run ../generator/generator.go DisconnectOptions
type DisconnectOptions struct { type DisconnectOptions struct {
// Force indicates to remove the container from // Force indicates to remove the container from
// the network forcibly // the network forcibly
Force *bool Force *bool
} }
//go:generate go run ../generator/generator.go ExistsOptions
// ExistsOptions are optional options for checking // ExistsOptions are optional options for checking
// if a network exists // if a network exists
//
//go:generate go run ../generator/generator.go ExistsOptions
type ExistsOptions struct { type ExistsOptions struct {
} }
//go:generate go run ../generator/generator.go PruneOptions
// PruneOptions are optional options for removing unused // PruneOptions are optional options for removing unused
// CNI networks // CNI networks
//
//go:generate go run ../generator/generator.go PruneOptions
type PruneOptions struct { type PruneOptions struct {
// Filters are applied to the prune of networks to be more // Filters are applied to the prune of networks to be more
// specific on choosing // specific on choosing

View File

@ -1,78 +1,92 @@
package pods package pods
//go:generate go run ../generator/generator.go CreateOptions
// CreateOptions are optional options for creating pods // CreateOptions are optional options for creating pods
//
//go:generate go run ../generator/generator.go CreateOptions
type CreateOptions struct { type CreateOptions struct {
} }
//go:generate go run ../generator/generator.go InspectOptions
// InspectOptions are optional options for inspecting pods // InspectOptions are optional options for inspecting pods
//
//go:generate go run ../generator/generator.go InspectOptions
type InspectOptions struct { type InspectOptions struct {
} }
//go:generate go run ../generator/generator.go KillOptions
// KillOptions are optional options for killing pods // KillOptions are optional options for killing pods
//
//go:generate go run ../generator/generator.go KillOptions
type KillOptions struct { type KillOptions struct {
Signal *string Signal *string
} }
//go:generate go run ../generator/generator.go PauseOptions
// PauseOptions are optional options for pausing pods // PauseOptions are optional options for pausing pods
//
//go:generate go run ../generator/generator.go PauseOptions
type PauseOptions struct { type PauseOptions struct {
} }
//go:generate go run ../generator/generator.go PruneOptions
// PruneOptions are optional options for pruning pods // PruneOptions are optional options for pruning pods
//
//go:generate go run ../generator/generator.go PruneOptions
type PruneOptions struct { type PruneOptions struct {
} }
//go:generate go run ../generator/generator.go ListOptions
// ListOptions are optional options for listing pods // ListOptions are optional options for listing pods
//
//go:generate go run ../generator/generator.go ListOptions
type ListOptions struct { type ListOptions struct {
Filters map[string][]string Filters map[string][]string
} }
//go:generate go run ../generator/generator.go RestartOptions
// RestartOptions are optional options for restarting pods // RestartOptions are optional options for restarting pods
//
//go:generate go run ../generator/generator.go RestartOptions
type RestartOptions struct { type RestartOptions struct {
} }
//go:generate go run ../generator/generator.go StartOptions
// StartOptions are optional options for starting pods // StartOptions are optional options for starting pods
//
//go:generate go run ../generator/generator.go StartOptions
type StartOptions struct { type StartOptions struct {
} }
//go:generate go run ../generator/generator.go StopOptions
// StopOptions are optional options for stopping pods // StopOptions are optional options for stopping pods
//
//go:generate go run ../generator/generator.go StopOptions
type StopOptions struct { type StopOptions struct {
Timeout *int Timeout *int
} }
//go:generate go run ../generator/generator.go TopOptions
// TopOptions are optional options for getting top on pods // TopOptions are optional options for getting top on pods
//
//go:generate go run ../generator/generator.go TopOptions
type TopOptions struct { type TopOptions struct {
Descriptors []string Descriptors []string
} }
//go:generate go run ../generator/generator.go UnpauseOptions
// UnpauseOptions are optional options for unpausinging pods // UnpauseOptions are optional options for unpausinging pods
//
//go:generate go run ../generator/generator.go UnpauseOptions
type UnpauseOptions struct { type UnpauseOptions struct {
} }
//go:generate go run ../generator/generator.go StatsOptions
// StatsOptions are optional options for getting stats of pods // StatsOptions are optional options for getting stats of pods
//
//go:generate go run ../generator/generator.go StatsOptions
type StatsOptions struct { type StatsOptions struct {
All *bool All *bool
} }
//go:generate go run ../generator/generator.go RemoveOptions
// RemoveOptions are optional options for removing pods // RemoveOptions are optional options for removing pods
//
//go:generate go run ../generator/generator.go RemoveOptions
type RemoveOptions struct { type RemoveOptions struct {
Force *bool Force *bool
Timeout *uint Timeout *uint
} }
//go:generate go run ../generator/generator.go ExistsOptions
// ExistsOptions are optional options for checking if a pod exists // ExistsOptions are optional options for checking if a pod exists
//
//go:generate go run ../generator/generator.go ExistsOptions
type ExistsOptions struct { type ExistsOptions struct {
} }

View File

@ -1,23 +1,27 @@
package secrets package secrets
//go:generate go run ../generator/generator.go ListOptions
// ListOptions are optional options for inspecting secrets // ListOptions are optional options for inspecting secrets
//
//go:generate go run ../generator/generator.go ListOptions
type ListOptions struct { type ListOptions struct {
Filters map[string][]string Filters map[string][]string
} }
//go:generate go run ../generator/generator.go InspectOptions
// InspectOptions are optional options for inspecting secrets // InspectOptions are optional options for inspecting secrets
//
//go:generate go run ../generator/generator.go InspectOptions
type InspectOptions struct { type InspectOptions struct {
} }
//go:generate go run ../generator/generator.go RemoveOptions
// RemoveOptions are optional options for removing secrets // RemoveOptions are optional options for removing secrets
//
//go:generate go run ../generator/generator.go RemoveOptions
type RemoveOptions struct { type RemoveOptions struct {
} }
//go:generate go run ../generator/generator.go CreateOptions
// CreateOptions are optional options for Creating secrets // CreateOptions are optional options for Creating secrets
//
//go:generate go run ../generator/generator.go CreateOptions
type CreateOptions struct { type CreateOptions struct {
Name *string Name *string
Driver *string Driver *string

View File

@ -1,7 +1,8 @@
package system package system
//go:generate go run ../generator/generator.go EventsOptions
// EventsOptions are optional options for monitoring events // EventsOptions are optional options for monitoring events
//
//go:generate go run ../generator/generator.go EventsOptions
type EventsOptions struct { type EventsOptions struct {
Filters map[string][]string Filters map[string][]string
Since *string Since *string
@ -9,26 +10,30 @@ type EventsOptions struct {
Until *string Until *string
} }
//go:generate go run ../generator/generator.go PruneOptions
// PruneOptions are optional options for pruning // PruneOptions are optional options for pruning
//
//go:generate go run ../generator/generator.go PruneOptions
type PruneOptions struct { type PruneOptions struct {
All *bool All *bool
Filters map[string][]string Filters map[string][]string
Volumes *bool Volumes *bool
} }
//go:generate go run ../generator/generator.go VersionOptions
// VersionOptions are optional options for getting version info // VersionOptions are optional options for getting version info
//
//go:generate go run ../generator/generator.go VersionOptions
type VersionOptions struct { type VersionOptions struct {
} }
//go:generate go run ../generator/generator.go DiskOptions
// DiskOptions are optional options for getting storage consumption // DiskOptions are optional options for getting storage consumption
//
//go:generate go run ../generator/generator.go DiskOptions
type DiskOptions struct { type DiskOptions struct {
} }
//go:generate go run ../generator/generator.go InfoOptions
// InfoOptions are optional options for getting info // InfoOptions are optional options for getting info
// about libpod // about libpod
//
//go:generate go run ../generator/generator.go InfoOptions
type InfoOptions struct { type InfoOptions struct {
} }

View File

@ -242,8 +242,8 @@ func (b *bindingTest) PodcreateAndExpose(name *string, port *string) {
b.runPodman(command).Wait(45) b.runPodman(command).Wait(45)
} }
// StringInSlice returns a boolean based on whether a given // StringInSlice returns a boolean based on whether a given
// string is in a given slice // string is in a given slice
func StringInSlice(s string, sl []string) bool { func StringInSlice(s string, sl []string) bool {
for _, val := range sl { for _, val := range sl {
if s == val { if s == val {

View File

@ -1,39 +1,45 @@
package volumes package volumes
//go:generate go run ../generator/generator.go CreateOptions
// CreateOptions are optional options for creating volumes // CreateOptions are optional options for creating volumes
//
//go:generate go run ../generator/generator.go CreateOptions
type CreateOptions struct { type CreateOptions struct {
} }
//go:generate go run ../generator/generator.go InspectOptions
// InspectOptions are optional options for inspecting volumes // InspectOptions are optional options for inspecting volumes
//
//go:generate go run ../generator/generator.go InspectOptions
type InspectOptions struct { type InspectOptions struct {
} }
//go:generate go run ../generator/generator.go ListOptions
// ListOptions are optional options for listing volumes // ListOptions are optional options for listing volumes
//
//go:generate go run ../generator/generator.go ListOptions
type ListOptions struct { type ListOptions struct {
// Filters applied to the listing of volumes // Filters applied to the listing of volumes
Filters map[string][]string Filters map[string][]string
} }
//go:generate go run ../generator/generator.go PruneOptions
// PruneOptions are optional options for pruning volumes // PruneOptions are optional options for pruning volumes
//
//go:generate go run ../generator/generator.go PruneOptions
type PruneOptions struct { type PruneOptions struct {
// Filters applied to the pruning of volumes // Filters applied to the pruning of volumes
Filters map[string][]string Filters map[string][]string
} }
//go:generate go run ../generator/generator.go RemoveOptions
// RemoveOptions are optional options for removing volumes // RemoveOptions are optional options for removing volumes
//
//go:generate go run ../generator/generator.go RemoveOptions
type RemoveOptions struct { type RemoveOptions struct {
// Force removes the volume even if it is being used // Force removes the volume even if it is being used
Force *bool Force *bool
Timeout *uint Timeout *uint
} }
//go:generate go run ../generator/generator.go ExistsOptions
// ExistsOptions are optional options for checking // ExistsOptions are optional options for checking
// if a volume exists // if a volume exists
//
//go:generate go run ../generator/generator.go ExistsOptions
type ExistsOptions struct { type ExistsOptions struct {
} }

View File

@ -3,13 +3,13 @@ Package channel provides helper structs/methods/funcs for working with channels
Proxy from an io.Writer to a channel: Proxy from an io.Writer to a channel:
w := channel.NewWriter(make(chan []byte, 10)) w := channel.NewWriter(make(chan []byte, 10))
go func() { go func() {
w.Write([]byte("Hello, World")) w.Write([]byte("Hello, World"))
}() }()
fmt.Println(string(<-w.Chan())) fmt.Println(string(<-w.Chan()))
w.Close() w.Close()
Use of the constructor is required to initialize the channel. Use of the constructor is required to initialize the channel.
Provide a channel of sufficient size to handle messages from writer(s). Provide a channel of sufficient size to handle messages from writer(s).

View File

@ -13,7 +13,7 @@ import (
type ContainerCopyFunc func() error type ContainerCopyFunc func() error
type ContainerEngine interface { type ContainerEngine interface { //nolint:interfacebloat
AutoUpdate(ctx context.Context, options AutoUpdateOptions) ([]*AutoUpdateReport, []error) AutoUpdate(ctx context.Context, options AutoUpdateOptions) ([]*AutoUpdateReport, []error)
Config(ctx context.Context) (*config.Config, error) Config(ctx context.Context) (*config.Config, error)
ContainerAttach(ctx context.Context, nameOrID string, options AttachOptions) error ContainerAttach(ctx context.Context, nameOrID string, options AttachOptions) error

View File

@ -8,7 +8,7 @@ import (
"github.com/containers/podman/v4/pkg/domain/entities/reports" "github.com/containers/podman/v4/pkg/domain/entities/reports"
) )
type ImageEngine interface { type ImageEngine interface { //nolint:interfacebloat
Build(ctx context.Context, containerFiles []string, opts BuildOptions) (*BuildReport, error) Build(ctx context.Context, containerFiles []string, opts BuildOptions) (*BuildReport, error)
Config(ctx context.Context) (*config.Config, error) Config(ctx context.Context) (*config.Config, error)
Exists(ctx context.Context, nameOrID string) (*BoolReport, error) Exists(ctx context.Context, nameOrID string) (*BoolReport, error)

View File

@ -13,7 +13,8 @@ import (
) )
// FIXME: the `ignore` parameter is very likely wrong here as it should rather // FIXME: the `ignore` parameter is very likely wrong here as it should rather
// be used on *errors* from operations such as remove. //
// be used on *errors* from operations such as remove.
func getContainersByContext(contextWithConnection context.Context, all, ignore bool, namesOrIDs []string) ([]entities.ListContainer, error) { //nolint:unparam func getContainersByContext(contextWithConnection context.Context, all, ignore bool, namesOrIDs []string) ([]entities.ListContainer, error) { //nolint:unparam
ctrs, _, err := getContainersAndInputByContext(contextWithConnection, all, ignore, namesOrIDs, nil) ctrs, _, err := getContainersAndInputByContext(contextWithConnection, all, ignore, namesOrIDs, nil)
return ctrs, err return ctrs, err

View File

@ -38,8 +38,9 @@ const (
// StatefulSet represents a set of pods with consistent identities. // StatefulSet represents a set of pods with consistent identities.
// Identities are defined as: // Identities are defined as:
// - Network: A single stable DNS and hostname. // - Network: A single stable DNS and hostname.
// - Storage: As many VolumeClaims as requested. // - Storage: As many VolumeClaims as requested.
//
// The StatefulSet guarantees that a given network identity will always // The StatefulSet guarantees that a given network identity will always
// map to the same storage identity. // map to the same storage identity.
type StatefulSet struct { type StatefulSet struct {

View File

@ -26,6 +26,7 @@ func (rn ResourceName) String() string {
} }
// Cpu returns the Cpu limit if specified. // Cpu returns the Cpu limit if specified.
//
//nolint:revive,stylecheck //nolint:revive,stylecheck
func (rl *ResourceList) Cpu() *resource.Quantity { func (rl *ResourceList) Cpu() *resource.Quantity {
return rl.Name(ResourceCPU, resource.DecimalSI) return rl.Name(ResourceCPU, resource.DecimalSI)

View File

@ -2237,7 +2237,8 @@ type PodDNSConfigOption struct {
// IP address information for entries in the (plural) PodIPs field. // IP address information for entries in the (plural) PodIPs field.
// Each entry includes: // Each entry includes:
// IP: An IP address allocated to the pod. Routable at least within the cluster. //
// IP: An IP address allocated to the pod. Routable at least within the cluster.
type PodIP struct { type PodIP struct {
// ip is an IP address (IPv4 or IPv6) assigned to the pod // ip is an IP address (IPv4 or IPv6) assigned to the pod
IP string `json:"ip,omitempty"` IP string `json:"ip,omitempty"`
@ -3286,17 +3287,18 @@ type ServiceAccountList struct {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Endpoints is a collection of endpoints that implement the actual service. Example: // Endpoints is a collection of endpoints that implement the actual service. Example:
// Name: "mysvc", //
// Subsets: [ // Name: "mysvc",
// { // Subsets: [
// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], // {
// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] // Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}],
// }, // Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}]
// { // },
// Addresses: [{"ip": "10.10.3.3"}], // {
// Ports: [{"name": "a", "port": 93}, {"name": "b", "port": 76}] // Addresses: [{"ip": "10.10.3.3"}],
// }, // Ports: [{"name": "a", "port": 93}, {"name": "b", "port": 76}]
// ] // },
// ]
type Endpoints struct { type Endpoints struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
// Standard object's metadata. // Standard object's metadata.
@ -3318,13 +3320,16 @@ type Endpoints struct {
// EndpointSubset is a group of addresses with a common set of ports. The // EndpointSubset is a group of addresses with a common set of ports. The
// expanded set of endpoints is the Cartesian product of Addresses x Ports. // expanded set of endpoints is the Cartesian product of Addresses x Ports.
// For example, given: // For example, given:
// { //
// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], // {
// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] // Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}],
// } // Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}]
// }
//
// The resulting set of endpoints can be viewed as: // The resulting set of endpoints can be viewed as:
// a: [ 10.10.1.1:8675, 10.10.2.2:8675 ], //
// b: [ 10.10.1.1:309, 10.10.2.2:309 ] // a: [ 10.10.1.1:8675, 10.10.2.2:8675 ],
// b: [ 10.10.1.1:309, 10.10.2.2:309 ]
type EndpointSubset struct { type EndpointSubset struct {
// IP addresses which offer the related ports that are marked as ready. These endpoints // IP addresses which offer the related ports that are marked as ready. These endpoints
// should be considered safe for load balancers and clients to utilize. // should be considered safe for load balancers and clients to utilize.
@ -3656,6 +3661,7 @@ type ServiceProxyOptions struct {
// and the version of the actual struct is irrelevant. // and the version of the actual struct is irrelevant.
// 5. We cannot easily change it. Because this type is embedded in many locations, updates to this type // 5. We cannot easily change it. Because this type is embedded in many locations, updates to this type
// will affect numerous schemas. Don't make new APIs embed an underspecified API type they do not control. // will affect numerous schemas. Don't make new APIs embed an underspecified API type they do not control.
//
// Instead of using this type, create a locally provided and used type that is well-focused on your reference. // Instead of using this type, create a locally provided and used type that is well-focused on your reference.
// For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 . // For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 .
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

View File

@ -35,7 +35,9 @@ import (
// The serialization format is: // The serialization format is:
// //
// <quantity> ::= <signedNumber><suffix> // <quantity> ::= <signedNumber><suffix>
// (Note that <suffix> may be empty, from the "" case in <decimalSI>.) //
// (Note that <suffix> may be empty, from the "" case in <decimalSI>.)
//
// <digit> ::= 0 | 1 | ... | 9 // <digit> ::= 0 | 1 | ... | 9
// <digits> ::= <digit> | <digit><digits> // <digits> ::= <digit> | <digit><digits>
// <number> ::= <digits> | <digits>.<digits> | <digits>. | .<digits> // <number> ::= <digits> | <digits>.<digits> | <digits>. | .<digits>
@ -43,9 +45,13 @@ import (
// <signedNumber> ::= <number> | <sign><number> // <signedNumber> ::= <number> | <sign><number>
// <suffix> ::= <binarySI> | <decimalExponent> | <decimalSI> // <suffix> ::= <binarySI> | <decimalExponent> | <decimalSI>
// <binarySI> ::= Ki | Mi | Gi | Ti | Pi | Ei // <binarySI> ::= Ki | Mi | Gi | Ti | Pi | Ei
// (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) //
// (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)
//
// <decimalSI> ::= m | "" | k | M | G | T | P | E // <decimalSI> ::= m | "" | k | M | G | T | P | E
// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) //
// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
//
// <decimalExponent> ::= "e" <signedNumber> | "E" <signedNumber> // <decimalExponent> ::= "e" <signedNumber> | "E" <signedNumber>
// //
// No matter which of the three exponent forms is used, no quantity may represent // No matter which of the three exponent forms is used, no quantity may represent
@ -60,14 +66,17 @@ import (
// Before serializing, Quantity will be put in "canonical form". // Before serializing, Quantity will be put in "canonical form".
// This means that Exponent/suffix will be adjusted up or down (with a // This means that Exponent/suffix will be adjusted up or down (with a
// corresponding increase or decrease in Mantissa) such that: // corresponding increase or decrease in Mantissa) such that:
// a. No precision is lost //
// b. No fractional digits will be emitted // a. No precision is lost
// c. The exponent (or suffix) is as large as possible. // b. No fractional digits will be emitted
// c. The exponent (or suffix) is as large as possible.
//
// The sign will be omitted unless the number is negative. // The sign will be omitted unless the number is negative.
// //
// Examples: // Examples:
// 1.5 will be serialized as "1500m" //
// 1.5Gi will be serialized as "1536Mi" // 1.5 will be serialized as "1500m"
// 1.5Gi will be serialized as "1536Mi"
// //
// Note that the quantity will NEVER be internally represented by a // Note that the quantity will NEVER be internally represented by a
// floating point number. That is the whole point of this exercise. // floating point number. That is the whole point of this exercise.
@ -391,10 +400,10 @@ func (q Quantity) DeepCopy() Quantity {
// CanonicalizeBytes returns the canonical form of q and its suffix (see comment on Quantity). // CanonicalizeBytes returns the canonical form of q and its suffix (see comment on Quantity).
// //
// Note about BinarySI: // Note about BinarySI:
// * If q.Format is set to BinarySI and q.Amount represents a non-zero value between // - If q.Format is set to BinarySI and q.Amount represents a non-zero value between
// -1 and +1, it will be emitted as if q.Format were DecimalSI. // -1 and +1, it will be emitted as if q.Format were DecimalSI.
// * Otherwise, if q.Format is set to BinarySI, fractional parts of q.Amount will be // - Otherwise, if q.Format is set to BinarySI, fractional parts of q.Amount will be
// rounded up. (1.1i becomes 2i.) // rounded up. (1.1i becomes 2i.)
func (q *Quantity) CanonicalizeBytes(out []byte) (result, suffix []byte) { func (q *Quantity) CanonicalizeBytes(out []byte) (result, suffix []byte) {
if q.IsZero() { if q.IsZero() {
return zeroBytes, nil return zeroBytes, nil

View File

@ -17,10 +17,11 @@ limitations under the License.
// Package v1 contains API types that are common to all versions. // Package v1 contains API types that are common to all versions.
// //
// The package contains two categories of types: // The package contains two categories of types:
// - external (serialized) types that lack their own version (e.g TypeMeta) // - external (serialized) types that lack their own version (e.g TypeMeta)
// - internal (never-serialized) types that are needed by several different // - internal (never-serialized) types that are needed by several different
// api groups, and so live here, to avoid duplication and/or import loops // api groups, and so live here, to avoid duplication and/or import loops
// (e.g. LabelSelector). // (e.g. LabelSelector).
//
// In the future, we will probably move these categories of objects into // In the future, we will probably move these categories of objects into
// separate packages. // separate packages.
package v1 package v1
@ -1272,17 +1273,18 @@ type PartialObjectMetadataList struct {
// Condition contains details for one aspect of the current state of this API Resource. // Condition contains details for one aspect of the current state of this API Resource.
// --- // ---
// This struct is intended for direct use as an array at the field path .status.conditions. For example, // This struct is intended for direct use as an array at the field path .status.conditions. For example,
// type FooStatus struct{
// // Represents the observations of a foo's current state.
// // Known .status.conditions.type are: "Available", "Progressing", and "Degraded"
// // +patchMergeKey=type
// // +patchStrategy=merge
// // +listType=map
// // +listMapKey=type
// Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
// //
// // other fields // type FooStatus struct{
// } // // Represents the observations of a foo's current state.
// // Known .status.conditions.type are: "Available", "Progressing", and "Degraded"
// // +patchMergeKey=type
// // +patchStrategy=merge
// // +listType=map
// // +listMapKey=type
// Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
//
// // other fields
// }
type Condition struct { type Condition struct {
// type of condition in CamelCase or in foo.example.com/CamelCase. // type of condition in CamelCase or in foo.example.com/CamelCase.
// --- // ---

View File

@ -1,5 +1,5 @@
//go:build arm64 && !windows && !linux //go:build arm64 && !windows && !linux
// +build darwin // +build arm64,!windows,!linux
package applehv package applehv

View File

@ -1,4 +1,4 @@
//go:build (!amd64 && !arm64) //go:build !amd64 && !arm64
// +build !amd64,!arm64 // +build !amd64,!arm64
package qemu package qemu

View File

@ -19,7 +19,7 @@ import (
"github.com/containers/storage/pkg/homedir" "github.com/containers/storage/pkg/homedir"
) )
//nolint // nolint
type SHELLEXECUTEINFO struct { type SHELLEXECUTEINFO struct {
cbSize uint32 cbSize uint32
fMask uint32 fMask uint32
@ -38,7 +38,7 @@ type SHELLEXECUTEINFO struct {
hProcess syscall.Handle hProcess syscall.Handle
} }
//nolint // nolint
type Luid struct { type Luid struct {
lowPart uint32 lowPart uint32
highPart int32 highPart int32
@ -54,7 +54,7 @@ type TokenPrivileges struct {
privileges [1]LuidAndAttributes privileges [1]LuidAndAttributes
} }
//nolint // Cleaner to refer to the official OS constant names, and consistent with syscall // nolint // Cleaner to refer to the official OS constant names, and consistent with syscall
const ( const (
SEE_MASK_NOCLOSEPROCESS = 0x40 SEE_MASK_NOCLOSEPROCESS = 0x40
EWX_FORCEIFHUNG = 0x10 EWX_FORCEIFHUNG = 0x10

View File

@ -11,6 +11,7 @@ import (
// KubeSeccompPaths holds information about a pod YAML's seccomp configuration // KubeSeccompPaths holds information about a pod YAML's seccomp configuration
// it holds both container and pod seccomp paths // it holds both container and pod seccomp paths
//
//nolint:revive //nolint:revive
type KubeSeccompPaths struct { type KubeSeccompPaths struct {
containerPaths map[string]string containerPaths map[string]string

View File

@ -55,7 +55,8 @@ func joinTwoPortsToRangePortIfPossible(ports *[]types.PortMapping, allHostPorts,
} }
// joinTwoContainerPortsToRangePortIfPossible will expect two ports with both no host port set, // joinTwoContainerPortsToRangePortIfPossible will expect two ports with both no host port set,
// the previous port one must have a lower or equal containerPort than the current port. //
// the previous port one must have a lower or equal containerPort than the current port.
func joinTwoContainerPortsToRangePortIfPossible(ports *[]types.PortMapping, allHostPorts, allContainerPorts, currentHostPorts *[65536]bool, func joinTwoContainerPortsToRangePortIfPossible(ports *[]types.PortMapping, allHostPorts, allContainerPorts, currentHostPorts *[65536]bool,
previousPort *types.PortMapping, port types.PortMapping) (*types.PortMapping, error) { previousPort *types.PortMapping, port types.PortMapping) (*types.PortMapping, error) {
// no previous port just return the current one // no previous port just return the current one

View File

@ -103,8 +103,10 @@ func GetTimestamp(value string, reference time.Time) (string, error) {
// if the incoming nanosecond portion is longer or shorter than 9 digits it is // if the incoming nanosecond portion is longer or shorter than 9 digits it is
// converted to nanoseconds. The expectation is that the seconds and // converted to nanoseconds. The expectation is that the seconds and
// seconds will be used to create a time variable. For example: // seconds will be used to create a time variable. For example:
// seconds, nanoseconds, err := ParseTimestamp("1136073600.000000001",0) //
// if err == nil since := time.Unix(seconds, nanoseconds) // seconds, nanoseconds, err := ParseTimestamp("1136073600.000000001",0)
// if err == nil since := time.Unix(seconds, nanoseconds)
//
// returns seconds as def(aultSeconds) if value == "" // returns seconds as def(aultSeconds) if value == ""
func ParseTimestamps(value string, def int64) (int64, int64, error) { func ParseTimestamps(value string, def int64) (int64, int64, error) {
if value == "" { if value == "" {

View File

@ -13,37 +13,37 @@ import (
// //
// Examples // Examples
// //
// "" => [""] // "" => [""]
// "lowercase" => ["lowercase"] // "lowercase" => ["lowercase"]
// "Class" => ["Class"] // "Class" => ["Class"]
// "MyClass" => ["My", "Class"] // "MyClass" => ["My", "Class"]
// "MyC" => ["My", "C"] // "MyC" => ["My", "C"]
// "HTML" => ["HTML"] // "HTML" => ["HTML"]
// "PDFLoader" => ["PDF", "Loader"] // "PDFLoader" => ["PDF", "Loader"]
// "AString" => ["A", "String"] // "AString" => ["A", "String"]
// "SimpleXMLParser" => ["Simple", "XML", "Parser"] // "SimpleXMLParser" => ["Simple", "XML", "Parser"]
// "vimRPCPlugin" => ["vim", "RPC", "Plugin"] // "vimRPCPlugin" => ["vim", "RPC", "Plugin"]
// "GL11Version" => ["GL", "11", "Version"] // "GL11Version" => ["GL", "11", "Version"]
// "99Bottles" => ["99", "Bottles"] // "99Bottles" => ["99", "Bottles"]
// "May5" => ["May", "5"] // "May5" => ["May", "5"]
// "BFG9000" => ["BFG", "9000"] // "BFG9000" => ["BFG", "9000"]
// "BöseÜberraschung" => ["Böse", "Überraschung"] // "BöseÜberraschung" => ["Böse", "Überraschung"]
// "Two spaces" => ["Two", " ", "spaces"] // "Two spaces" => ["Two", " ", "spaces"]
// "BadUTF8\xe2\xe2\xa1" => ["BadUTF8\xe2\xe2\xa1"] // "BadUTF8\xe2\xe2\xa1" => ["BadUTF8\xe2\xe2\xa1"]
// //
// Splitting rules // Splitting rules
// //
// 1) If string is not valid UTF-8, return it without splitting as // 1. If string is not valid UTF-8, return it without splitting as
// single item array. // single item array.
// 2) Assign all unicode characters into one of 4 sets: lower case // 2. Assign all unicode characters into one of 4 sets: lower case
// letters, upper case letters, numbers, and all other characters. // letters, upper case letters, numbers, and all other characters.
// 3) Iterate through characters of string, introducing splits // 3. Iterate through characters of string, introducing splits
// between adjacent characters that belong to different sets. // between adjacent characters that belong to different sets.
// 4) Iterate through array of split strings, and if a given string // 4. Iterate through array of split strings, and if a given string
// is upper case: // is upper case:
// if subsequent string is lower case: // if subsequent string is lower case:
// move last character of upper case string to beginning of // move last character of upper case string to beginning of
// lower case string // lower case string
func Split(src string) (entries []string) { func Split(src string) (entries []string) {
// don't split invalid utf8 // don't split invalid utf8
if !utf8.ValidString(src) { if !utf8.ValidString(src) {

View File

@ -34,7 +34,8 @@ var Version = semver.MustParse("4.3.0-dev")
// APIVersion provides the current and minimal API versions for compat and libpod endpoint trees // APIVersion provides the current and minimal API versions for compat and libpod endpoint trees
// Note: GET|HEAD /_ping is never versioned and provides the API-Version and Libpod-API-Version headers to allow // Note: GET|HEAD /_ping is never versioned and provides the API-Version and Libpod-API-Version headers to allow
// clients to shop for the Version they wish to support //
// clients to shop for the Version they wish to support
var APIVersion = map[Tree]map[Level]semver.Version{ var APIVersion = map[Tree]map[Level]semver.Version{
Libpod: { Libpod: {
CurrentAPI: Version, CurrentAPI: Version,