Run gofmt 1.19
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
@@ -18,10 +18,11 @@ package apparmor
|
||||
|
||||
// HostSupports returns true if apparmor is enabled for the host, // On non-Linux returns false
|
||||
// On Linux returns true if apparmor_parser is enabled, and if we
|
||||
// are not running docker-in-docker.
|
||||
//
|
||||
// It is a modified version of libcontainer/apparmor.IsEnabled(), which does not
|
||||
// check for apparmor_parser to be present, or if we're running docker-in-docker.
|
||||
// are not running docker-in-docker.
|
||||
//
|
||||
// It is a modified version of libcontainer/apparmor.IsEnabled(), which does not
|
||||
// check for apparmor_parser to be present, or if we're running docker-in-docker.
|
||||
func HostSupports() bool {
|
||||
return hostSupports()
|
||||
}
|
||||
|
||||
@@ -77,7 +77,8 @@ func WithProcessArgs(config *runtime.ContainerConfig, image *imagespec.ImageConf
|
||||
|
||||
// mounts defines how to sort runtime.Mount.
|
||||
// This is the same with the Docker implementation:
|
||||
// https://github.com/moby/moby/blob/17.05.x/daemon/volumes.go#L26
|
||||
//
|
||||
// https://github.com/moby/moby/blob/17.05.x/daemon/volumes.go#L26
|
||||
type orderedMounts []*runtime.Mount
|
||||
|
||||
// Len returns the number of mounts. Used in sorting.
|
||||
|
||||
@@ -234,11 +234,11 @@ func convertEvent(e typeurl.Any) (string, interface{}, error) {
|
||||
// event monitor.
|
||||
//
|
||||
// NOTE:
|
||||
// 1. start must be called after subscribe.
|
||||
// 2. The task exit event has been handled in individual startSandboxExitMonitor
|
||||
// or startContainerExitMonitor goroutine at the first. If the goroutine fails,
|
||||
// it puts the event into backoff retry queue and event monitor will handle
|
||||
// it later.
|
||||
// 1. start must be called after subscribe.
|
||||
// 2. The task exit event has been handled in individual startSandboxExitMonitor
|
||||
// or startContainerExitMonitor goroutine at the first. If the goroutine fails,
|
||||
// it puts the event into backoff retry queue and event monitor will handle
|
||||
// it later.
|
||||
func (em *eventMonitor) start() <-chan error {
|
||||
errCh := make(chan error)
|
||||
if em.ch == nil || em.errCh == nil {
|
||||
|
||||
@@ -234,11 +234,11 @@ func convertEvent(e typeurl.Any) (string, interface{}, error) {
|
||||
// event monitor.
|
||||
//
|
||||
// NOTE:
|
||||
// 1. start must be called after subscribe.
|
||||
// 2. The task exit event has been handled in individual startSandboxExitMonitor
|
||||
// or startContainerExitMonitor goroutine at the first. If the goroutine fails,
|
||||
// it puts the event into backoff retry queue and event monitor will handle
|
||||
// it later.
|
||||
// 1. start must be called after subscribe.
|
||||
// 2. The task exit event has been handled in individual startSandboxExitMonitor
|
||||
// or startContainerExitMonitor goroutine at the first. If the goroutine fails,
|
||||
// it puts the event into backoff retry queue and event monitor will handle
|
||||
// it later.
|
||||
func (em *eventMonitor) start() <-chan error {
|
||||
errCh := make(chan error)
|
||||
if em.ch == nil || em.errCh == nil {
|
||||
|
||||
@@ -45,7 +45,7 @@ import (
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
restful "github.com/emicklei/go-restful/v3"
|
||||
"github.com/emicklei/go-restful/v3"
|
||||
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
remotecommandconsts "k8s.io/apimachinery/pkg/util/remotecommand"
|
||||
@@ -162,9 +162,10 @@ func NewServer(config Config, runtime Runtime) (Server, error) {
|
||||
handler.Add(ws)
|
||||
s.handler = handler
|
||||
s.server = &http.Server{
|
||||
Addr: s.config.Addr,
|
||||
Handler: s.handler,
|
||||
TLSConfig: s.config.TLSConfig,
|
||||
Addr: s.config.Addr,
|
||||
Handler: s.handler,
|
||||
TLSConfig: s.config.TLSConfig,
|
||||
ReadHeaderTimeout: 3 * time.Second, // Fix linter G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server
|
||||
}
|
||||
|
||||
return s, nil
|
||||
|
||||
@@ -68,7 +68,7 @@ func (t Type) String() string {
|
||||
// user. The user controlled variable will be parsed for how the error injected
|
||||
// code should fire. There is the way to set the rule for failpoint.
|
||||
//
|
||||
// <count>*<type>[(arg)][-><more terms>]
|
||||
// <count>*<type>[(arg)][-><more terms>]
|
||||
//
|
||||
// The <type> argument specifies which action to take; it can be one of:
|
||||
//
|
||||
|
||||
@@ -73,10 +73,10 @@ func (n *nopWriteCloser) Close() error {
|
||||
// serialWriteCloser wraps a write closer and makes sure all writes
|
||||
// are done in serial.
|
||||
// Parallel write won't intersect with each other. Use case:
|
||||
// 1) Pipe: Write content longer than PIPE_BUF.
|
||||
// See http://man7.org/linux/man-pages/man7/pipe.7.html
|
||||
// 2) <3.14 Linux Kernel: write is not atomic
|
||||
// See http://man7.org/linux/man-pages/man2/write.2.html
|
||||
// 1. Pipe: Write content longer than PIPE_BUF.
|
||||
// See http://man7.org/linux/man-pages/man7/pipe.7.html
|
||||
// 2. <3.14 Linux Kernel: write is not atomic
|
||||
// See http://man7.org/linux/man-pages/man2/write.2.html
|
||||
type serialWriteCloser struct {
|
||||
mu sync.Mutex
|
||||
wc io.WriteCloser
|
||||
|
||||
@@ -29,9 +29,10 @@ import (
|
||||
// It works for both file and directory paths.
|
||||
//
|
||||
// We are not able to use builtin Go functionality for opening a directory path:
|
||||
// - os.Open on a directory returns a os.File where Fd() is a search handle from FindFirstFile.
|
||||
// - syscall.Open does not provide a way to specify FILE_FLAG_BACKUP_SEMANTICS, which is needed to
|
||||
// open a directory.
|
||||
// - os.Open on a directory returns a os.File where Fd() is a search handle from FindFirstFile.
|
||||
// - syscall.Open does not provide a way to specify FILE_FLAG_BACKUP_SEMANTICS, which is needed to
|
||||
// open a directory.
|
||||
//
|
||||
// We could use os.Open if the path is a file, but it's easier to just use the same code for both.
|
||||
// Therefore, we call windows.CreateFile directly.
|
||||
func openPath(path string) (windows.Handle, error) {
|
||||
@@ -58,6 +59,7 @@ func openPath(path string) (windows.Handle, error) {
|
||||
}
|
||||
|
||||
// GetFinalPathNameByHandle flags.
|
||||
//
|
||||
//nolint:revive // SNAKE_CASE is not idiomatic in Go, but aligned with Win32 API.
|
||||
const (
|
||||
cFILE_NAME_OPENED = 0x8
|
||||
|
||||
Reference in New Issue
Block a user