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:
# All these break for one reason or another
- tagliatelle # too many JSON keys cannot be changed due to compat
- nosnakecase # too many false positives due to the `unix` package
- gocognit
- testpackage
- goerr113

View File

@ -866,7 +866,7 @@ install.tools: .install.ginkgo .install.golangci-lint .install.swagger ## Instal
.PHONY: .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
.install.swagger:

View File

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

View File

@ -25,11 +25,13 @@ func (o OutputErrors) PrintErrors() (lastError error) {
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
exit status which was expected for this current build
instead returns a message and we cast it to a new error.
Following function performs parsing on build error and returns
exit status which was expected for this current build
*/
func ExitCodeFromBuildError(errorMsg string) (int, error) {
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
//
// 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())
func Value(p *string, choices ...string) *ChoiceValue {
return &ChoiceValue{

View File

@ -166,7 +166,7 @@ func findBindMount(c *Container, containerPath string) *specs.Mount {
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.
func isPathOnMount(c *Container, containerPath string) bool {
cleanedContainerPath := filepath.Clean(containerPath)

View File

@ -265,6 +265,7 @@ type HealthCheckLog struct {
// as possible from the spec and container config.
// Some things cannot be inferred. These will be populated by spec annotations
// (if available).
//
//nolint:revive,stylecheck // Field names are fixed for compatibility and cannot be changed.
type InspectContainerHostConfig struct {
// 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
// segment.
type SHMLocks struct {
type SHMLocks struct { //nolint:revive // linter complains about stutter
lockStruct *C.shm_struct_t
maxLocks uint32
valid bool

View File

@ -16,7 +16,7 @@ import (
// The code calling the OCIRuntime will manage this.
// TODO: May want to move the conmon cleanup code here - it depends on
// Conmon being in use.
type OCIRuntime interface {
type OCIRuntime interface { //nolint:interfacebloat
// Name returns the name of the runtime.
Name() string
// 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)
}
// 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:
// 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
// conmon will then send the exit code of the exec process, or an error in the 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 and is used for two things:
//
// 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.
// 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.
// 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.
//
// 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.
//
// 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:
// 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

View File

@ -1317,7 +1317,7 @@ func (r *ConmonOCIRuntime) sharedConmonArgs(ctr *Container, cuuid, bundlePath, p
case define.PassthroughLogging:
logDriverArg = define.PassthroughLogging
//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
logrus.Errorf("%s logging specified but not supported. Choosing k8s-file logging instead", ctr.LogDriver())
fallthrough

View File

@ -74,7 +74,7 @@ type activateResponse struct {
func validatePlugin(newPlugin *VolumePlugin) error {
// It's a socket. Is it a plugin?
// 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 {
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
// 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)
}
@ -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 {
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.
// Let's interpret anything other than 200 as an error.
// 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)
if err != nil {
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.
// Generally speaking, the syncContainer() call should be run at the beginning
// 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
// connections) that may be required
Close() error

View File

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

View File

@ -1,17 +1,15 @@
// 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
// comments can be provided for the developer documentation.
// - models.go: declares the models used in API requests.
// - responses.go: declares the responses used in the API responses.
//
// - errors.go: declares the errors used in the API. By embedding errors.ErrorModel, more meaningful
// comments can be provided for the developer documentation.
// - models.go: declares the models used in API requests.
// - responses.go: declares the responses used in the API responses.
//
// Notes:
// 1. As a developer of the Podman API, you are responsible for maintaining the associations between
// 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.
// 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
// exist outside this package and should be found in the entities package.
//
// 1. As a developer of the Podman API, you are responsible for maintaining the associations between
// 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.
// 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
// exist outside this package and should be found in the entities package.
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,
// otherwise docker client would freeze.
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(200)
w.WriteHeader(http.StatusOK)
if flusher, ok := w.(http.Flusher); ok {
flusher.Flush()
}

View File

@ -12,7 +12,7 @@ import (
)
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]),
nil)
if err != nil {
@ -55,7 +55,7 @@ func TestSupportedVersion(t *testing.T) {
func TestUnsupportedVersion(t *testing.T) {
version := "999.999.999"
req, err := http.NewRequest("GET",
req, err := http.NewRequest(http.MethodGet,
fmt.Sprintf("/v%s/libpod/testing/versions", version),
nil)
if err != nil {
@ -98,7 +98,7 @@ func TestUnsupportedVersion(t *testing.T) {
func TestEqualVersion(t *testing.T) {
version := "1.30.0"
req, err := http.NewRequest("GET",
req, err := http.NewRequest(http.MethodGet,
fmt.Sprintf("/v%s/libpod/testing/versions", version),
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):
//
// podman system service -t 5000 &
// podman system service -t 5000 &
//
// You can then use cURL on the socket using requests documented below.
//
@ -23,44 +23,44 @@
//
// 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:
//
// https://github.com/containers/podman/blob/913caaa9b1de2b63692c9bae15120208194c9eb3/LICENSE
//
// Schemes: http, https
// Host: podman.io
// BasePath: /
// Version: 4.0.0
// License: Apache-2.0 https://opensource.org/licenses/Apache-2.0
// Contact: Podman <podman@lists.podman.io> https://podman.io/community/
// Schemes: http, https
// Host: podman.io
// BasePath: /
// Version: 4.0.0
// License: Apache-2.0 https://opensource.org/licenses/Apache-2.0
// Contact: Podman <podman@lists.podman.io> https://podman.io/community/
//
// InfoExtensions:
// x-logo:
// - url: https://raw.githubusercontent.com/containers/libpod/main/logo/podman-logo.png
// - altText: "Podman logo"
// InfoExtensions:
// x-logo:
// - url: https://raw.githubusercontent.com/containers/libpod/main/logo/podman-logo.png
// - altText: "Podman logo"
//
// Produces:
// - application/json
// - application/octet-stream
// - text/plain
// Produces:
// - application/json
// - application/octet-stream
// - text/plain
//
// Consumes:
// - application/json
// - application/x-tar
// Consumes:
// - application/json
// - application/x-tar
//
// swagger:meta
package server

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,39 +1,45 @@
package volumes
//go:generate go run ../generator/generator.go CreateOptions
// CreateOptions are optional options for creating volumes
//
//go:generate go run ../generator/generator.go CreateOptions
type CreateOptions struct {
}
//go:generate go run ../generator/generator.go InspectOptions
// InspectOptions are optional options for inspecting volumes
//
//go:generate go run ../generator/generator.go InspectOptions
type InspectOptions struct {
}
//go:generate go run ../generator/generator.go ListOptions
// ListOptions are optional options for listing volumes
//
//go:generate go run ../generator/generator.go ListOptions
type ListOptions struct {
// Filters applied to the listing of volumes
Filters map[string][]string
}
//go:generate go run ../generator/generator.go PruneOptions
// PruneOptions are optional options for pruning volumes
//
//go:generate go run ../generator/generator.go PruneOptions
type PruneOptions struct {
// Filters applied to the pruning of volumes
Filters map[string][]string
}
//go:generate go run ../generator/generator.go RemoveOptions
// RemoveOptions are optional options for removing volumes
//
//go:generate go run ../generator/generator.go RemoveOptions
type RemoveOptions struct {
// Force removes the volume even if it is being used
Force *bool
Timeout *uint
}
//go:generate go run ../generator/generator.go ExistsOptions
// ExistsOptions are optional options for checking
// if a volume exists
//
//go:generate go run ../generator/generator.go ExistsOptions
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:
w := channel.NewWriter(make(chan []byte, 10))
go func() {
w.Write([]byte("Hello, World"))
}()
w := channel.NewWriter(make(chan []byte, 10))
go func() {
w.Write([]byte("Hello, World"))
}()
fmt.Println(string(<-w.Chan()))
w.Close()
fmt.Println(string(<-w.Chan()))
w.Close()
Use of the constructor is required to initialize the channel.
Provide a channel of sufficient size to handle messages from writer(s).

View File

@ -13,7 +13,7 @@ import (
type ContainerCopyFunc func() error
type ContainerEngine interface {
type ContainerEngine interface { //nolint:interfacebloat
AutoUpdate(ctx context.Context, options AutoUpdateOptions) ([]*AutoUpdateReport, []error)
Config(ctx context.Context) (*config.Config, 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"
)
type ImageEngine interface {
type ImageEngine interface { //nolint:interfacebloat
Build(ctx context.Context, containerFiles []string, opts BuildOptions) (*BuildReport, error)
Config(ctx context.Context) (*config.Config, 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
// 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
ctrs, _, err := getContainersAndInputByContext(contextWithConnection, all, ignore, namesOrIDs, nil)
return ctrs, err

View File

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

View File

@ -26,6 +26,7 @@ func (rn ResourceName) String() string {
}
// Cpu returns the Cpu limit if specified.
//
//nolint:revive,stylecheck
func (rl *ResourceList) Cpu() *resource.Quantity {
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.
// 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 {
// ip is an IP address (IPv4 or IPv6) assigned to the pod
IP string `json:"ip,omitempty"`
@ -3286,17 +3287,18 @@ type ServiceAccountList struct {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Endpoints is a collection of endpoints that implement the actual service. Example:
// 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.3.3"}],
// Ports: [{"name": "a", "port": 93}, {"name": "b", "port": 76}]
// },
// ]
//
// 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.3.3"}],
// Ports: [{"name": "a", "port": 93}, {"name": "b", "port": 76}]
// },
// ]
type Endpoints struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
@ -3318,13 +3320,16 @@ type Endpoints struct {
// 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.
// 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:
// 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 {
// 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.
@ -3656,6 +3661,7 @@ type ServiceProxyOptions struct {
// 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
// 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.
// 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

View File

@ -35,7 +35,9 @@ import (
// The serialization format is:
//
// <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
// <digits> ::= <digit> | <digit><digits>
// <number> ::= <digits> | <digits>.<digits> | <digits>. | .<digits>
@ -43,9 +45,13 @@ import (
// <signedNumber> ::= <number> | <sign><number>
// <suffix> ::= <binarySI> | <decimalExponent> | <decimalSI>
// <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
// (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>
//
// 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".
// This means that Exponent/suffix will be adjusted up or down (with a
// corresponding increase or decrease in Mantissa) such that:
// a. No precision is lost
// b. No fractional digits will be emitted
// c. The exponent (or suffix) is as large as possible.
//
// a. No precision is lost
// 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.
//
// 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
// 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).
//
// Note about BinarySI:
// * 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.
// * Otherwise, if q.Format is set to BinarySI, fractional parts of q.Amount will be
// rounded up. (1.1i becomes 2i.)
// - 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.
// - Otherwise, if q.Format is set to BinarySI, fractional parts of q.Amount will be
// rounded up. (1.1i becomes 2i.)
func (q *Quantity) CanonicalizeBytes(out []byte) (result, suffix []byte) {
if q.IsZero() {
return zeroBytes, nil

View File

@ -17,10 +17,11 @@ limitations under the License.
// Package v1 contains API types that are common to all versions.
//
// The package contains two categories of types:
// - external (serialized) types that lack their own version (e.g TypeMeta)
// - internal (never-serialized) types that are needed by several different
// api groups, and so live here, to avoid duplication and/or import loops
// (e.g. LabelSelector).
// - external (serialized) types that lack their own version (e.g TypeMeta)
// - internal (never-serialized) types that are needed by several different
// api groups, and so live here, to avoid duplication and/or import loops
// (e.g. LabelSelector).
//
// In the future, we will probably move these categories of objects into
// separate packages.
package v1
@ -1272,17 +1273,18 @@ type PartialObjectMetadataList struct {
// 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,
// 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 of condition in CamelCase or in foo.example.com/CamelCase.
// ---

View File

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

View File

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

View File

@ -19,7 +19,7 @@ import (
"github.com/containers/storage/pkg/homedir"
)
//nolint
// nolint
type SHELLEXECUTEINFO struct {
cbSize uint32
fMask uint32
@ -38,7 +38,7 @@ type SHELLEXECUTEINFO struct {
hProcess syscall.Handle
}
//nolint
// nolint
type Luid struct {
lowPart uint32
highPart int32
@ -54,7 +54,7 @@ type TokenPrivileges struct {
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 (
SEE_MASK_NOCLOSEPROCESS = 0x40
EWX_FORCEIFHUNG = 0x10

View File

@ -11,6 +11,7 @@ import (
// KubeSeccompPaths holds information about a pod YAML's seccomp configuration
// it holds both container and pod seccomp paths
//
//nolint:revive
type KubeSeccompPaths struct {
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,
// 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,
previousPort *types.PortMapping, port types.PortMapping) (*types.PortMapping, error) {
// 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
// converted to nanoseconds. The expectation is that the seconds and
// 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 == ""
func ParseTimestamps(value string, def int64) (int64, int64, error) {
if value == "" {

View File

@ -13,37 +13,37 @@ import (
//
// Examples
//
// "" => [""]
// "lowercase" => ["lowercase"]
// "Class" => ["Class"]
// "MyClass" => ["My", "Class"]
// "MyC" => ["My", "C"]
// "HTML" => ["HTML"]
// "PDFLoader" => ["PDF", "Loader"]
// "AString" => ["A", "String"]
// "SimpleXMLParser" => ["Simple", "XML", "Parser"]
// "vimRPCPlugin" => ["vim", "RPC", "Plugin"]
// "GL11Version" => ["GL", "11", "Version"]
// "99Bottles" => ["99", "Bottles"]
// "May5" => ["May", "5"]
// "BFG9000" => ["BFG", "9000"]
// "BöseÜberraschung" => ["Böse", "Überraschung"]
// "Two spaces" => ["Two", " ", "spaces"]
// "BadUTF8\xe2\xe2\xa1" => ["BadUTF8\xe2\xe2\xa1"]
// "" => [""]
// "lowercase" => ["lowercase"]
// "Class" => ["Class"]
// "MyClass" => ["My", "Class"]
// "MyC" => ["My", "C"]
// "HTML" => ["HTML"]
// "PDFLoader" => ["PDF", "Loader"]
// "AString" => ["A", "String"]
// "SimpleXMLParser" => ["Simple", "XML", "Parser"]
// "vimRPCPlugin" => ["vim", "RPC", "Plugin"]
// "GL11Version" => ["GL", "11", "Version"]
// "99Bottles" => ["99", "Bottles"]
// "May5" => ["May", "5"]
// "BFG9000" => ["BFG", "9000"]
// "BöseÜberraschung" => ["Böse", "Überraschung"]
// "Two spaces" => ["Two", " ", "spaces"]
// "BadUTF8\xe2\xe2\xa1" => ["BadUTF8\xe2\xe2\xa1"]
//
// 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.
// 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.
// 3) Iterate through characters of string, introducing splits
// 3. Iterate through characters of string, introducing splits
// 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:
// if subsequent string is lower case:
// move last character of upper case string to beginning of
// lower case string
// if subsequent string is lower case:
// move last character of upper case string to beginning of
// lower case string
func Split(src string) (entries []string) {
// don't split invalid utf8
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
// 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{
Libpod: {
CurrentAPI: Version,