repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/network.go
environment/vm/lima/network.go
package lima import ( "fmt" "os" "path/filepath" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/config/configmanager" "github.com/abiosoft/colima/embedded" "github.com/abiosoft/colima/environment/vm/lima/limautil" "github.com/abiosoft/colima/util" "github.com/sirupsen/logrus" ) func (l *lim...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/file.go
environment/vm/lima/file.go
package lima import ( "bytes" "fmt" "io/fs" "os" "path/filepath" "strconv" "strings" "time" "github.com/abiosoft/colima/environment" ) func (l limaVM) Read(fileName string) (string, error) { s, err := l.RunOutput("sudo", "cat", fileName) if err != nil { return "", fmt.Errorf("cannot read file '%s': %w",...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/config.go
environment/vm/lima/config.go
package lima import ( "context" "encoding/json" "fmt" "path/filepath" ) const configFile = "/etc/colima/colima.json" func (l limaVM) getConf() map[string]string { log := l.Logger(context.Background()) obj := map[string]string{} b, err := l.Read(configFile) if err != nil { log.Trace(fmt.Errorf("error readi...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/yaml_test.go
environment/vm/lima/yaml_test.go
package lima import ( "context" "fmt" "strconv" "strings" "testing" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/environment/vm/lima/limaconfig" "github.com/abiosoft/colima/util" "github.com/abiosoft/colima/util/fsutil" ) func Test_checkOverlappingMounts(t *testing.T) { type args struct ...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/shell.go
environment/vm/lima/shell.go
package lima import ( "context" "io" "github.com/abiosoft/colima/config" ) func (l limaVM) Run(args ...string) error { args = append([]string{lima}, args...) a := l.Init(context.Background()) a.Add(func() error { return l.host.Run(args...) }) return a.Exec() } func (l limaVM) SSH(workingDir string, arg...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/yaml.go
environment/vm/lima/yaml.go
package lima import ( "context" "fmt" "net" "os" "strings" "github.com/abiosoft/colima/daemon" "github.com/abiosoft/colima/daemon/process/vmnet" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/environment" "github.com/abiosoft/colima/environment/container/containerd" "github.com/abiosoft/c...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/dns.go
environment/vm/lima/dns.go
package lima import ( "bytes" "fmt" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/environment/vm/lima/limautil" ) const ( localhostAddr = "127.0.0.1" gatewayAddr = "192.168.5.2" ) var dnsHosts = map[string]string{ "host.docker.internal": gatewayAddr, "host.lima.internal": gatewayAddr, ...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/disk.go
environment/vm/lima/disk.go
package lima import ( "context" "fmt" "os" "strings" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/config/configmanager" "github.com/abiosoft/colima/environment" "github.com/abiosoft/colima/environment/container/containerd" "github.com/abiosoft/colima/environment/container/docker" "github....
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/daemon.go
environment/vm/lima/daemon.go
package lima import ( "context" "fmt" "time" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/daemon" "github.com/abiosoft/colima/daemon/process/inotify" "github.com/abiosoft/colima/daemon/process/vmnet" "github.com/abiosoft/colima/environment/container/incus" "github.com/abiosoft/colima/envir...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/certs.go
environment/vm/lima/certs.go
package lima import ( "context" "fmt" "path/filepath" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/util" ) func (l limaVM) copyCerts() error { log := l.Logger(context.Background()) err := func() error { dockerCertsDirHost := filepath.Join(util.HomeDir(), ".docker", "certs.d") dockerCert...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/limautil/network.go
environment/vm/lima/limautil/network.go
package limautil import ( "bytes" "strings" ) // network interface for shared network in the virtual machine. const NetInterface = "col0" // network metric for the route const NetMetric uint32 = 300 const NetMetricPreferred uint32 = 100 // IPAddress returns the ip address for profile. // It returns the PTP addres...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/limautil/image.go
environment/vm/lima/limautil/image.go
package limautil import ( "bufio" "bytes" "fmt" "io" "os" "strings" "github.com/abiosoft/colima/embedded" "github.com/abiosoft/colima/environment" "github.com/abiosoft/colima/environment/host" "github.com/abiosoft/colima/environment/vm/lima/limaconfig" "github.com/abiosoft/colima/util" "github.com/abiosof...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/limautil/ssh.go
environment/vm/lima/limautil/ssh.go
package limautil import ( "bufio" "bytes" "fmt" "os" "path/filepath" "strings" "github.com/abiosoft/colima/config" ) // ShowSSH runs the show-ssh command in Lima. // returns the ssh output, if in layer, and an error if any func ShowSSH(profileID string) (resp struct { Output string File struct { Lima ...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/limautil/instance.go
environment/vm/lima/limautil/instance.go
package limautil import ( "bufio" "bytes" "encoding/json" "fmt" "strings" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/config/configmanager" ) // Instance returns current instance. func Instance() (InstanceInfo, error) { return getInstance(config.CurrentProfile().ID) } // InstanceInfo is ...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/limautil/limautil.go
environment/vm/lima/limautil/limautil.go
package limautil import ( "os" "os/exec" "github.com/abiosoft/colima/cli" "github.com/abiosoft/colima/config" ) // EnvLimaHome is the environment variable for the Lima directory. const EnvLimaHome = "LIMA_HOME" // LimactlCommand is the limactl command. const LimactlCommand = "limactl" // Limactl prepares a lim...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/limautil/disk.go
environment/vm/lima/limautil/disk.go
package limautil import ( "bytes" "encoding/json" "fmt" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/store" ) // HasDisk checks if a lima disk exists for the current instance. func HasDisk() bool { name := config.CurrentProfile().ID var resp struct { Name string `json:"name"` } cmd :=...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/limautil/files.go
environment/vm/lima/limautil/files.go
package limautil import ( "path/filepath" "github.com/abiosoft/colima/config" ) const colimaDiffDiskFile = "diffdisk" // ColimaDiffDisk returns path to the diffdisk for the colima VM. func ColimaDiffDisk(profileID string) string { return filepath.Join(config.ProfileFromName(profileID).LimaInstanceDir(), colimaDi...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/environment/vm/lima/limaconfig/config.go
environment/vm/lima/limaconfig/config.go
package limaconfig import ( "net" "github.com/abiosoft/colima/environment" ) type Arch = environment.Arch // Config is lima config. Code copied from lima and modified. type Config struct { VMType VMType `yaml:"vmType,omitempty" json:"vmType,omitempty"` VMOpts VMOpts ...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/core/core.go
core/core.go
package core import ( "bytes" "encoding/json" "fmt" "strings" "github.com/sirupsen/logrus" "github.com/abiosoft/colima/cli" "github.com/abiosoft/colima/environment" "github.com/coreos/go-semver/semver" ) const limaVersion = "v0.18.0" // minimum Lima version supported type ( hostActions = environment.Host...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/config/profile.go
config/profile.go
package config import ( "path/filepath" "strings" ) var profile = &Profile{ID: AppName, DisplayName: AppName, ShortName: "default"} // SetProfile sets the profile name for the application. // This is an avenue to test Colima without breaking an existing stable setup. // Not perfect, but good enough for testing. fu...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/config/config.go
config/config.go
package config import ( "fmt" "net" "github.com/abiosoft/colima/util" "github.com/abiosoft/colima/util/osutil" ) const ( AppName = "colima" envProfile = "COLIMA_PROFILE" // environment variable for profile name ) // VersionInfo is the application version info. type VersionInfo struct { Version string Re...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/config/files.go
config/files.go
package config import ( "fmt" "os" "path/filepath" "sync" "github.com/abiosoft/colima/util" "github.com/abiosoft/colima/util/fsutil" "github.com/sirupsen/logrus" ) // requiredDir is a directory that must exist on the filesystem type requiredDir struct { once sync.Once // dir is a func to enable deferring t...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/config/configmanager/configmanager.go
config/configmanager/configmanager.go
package configmanager import ( "fmt" "os" "strings" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/util" "github.com/abiosoft/colima/util/yamlutil" "gopkg.in/yaml.v3" ) // Save saves the config. func Save(c config.Config) error { return yamlutil.Save(c, config.CurrentProfile().File()) } // ...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/cli/chain.go
cli/chain.go
package cli import ( "context" "fmt" "io" "time" log "github.com/sirupsen/logrus" ) // CtxKeyQuiet is the context key to mute the chain. var CtxKeyQuiet = struct{ key string }{key: "quiet"} // errNonFatal is a non fatal error type errNonFatal struct { err error } // Error implements error func (e errNonFatal...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/cli/command.go
cli/command.go
package cli import ( "fmt" "os" "os/exec" "strconv" log "github.com/sirupsen/logrus" ) var runner commandRunner = &defaultCommandRunner{} // Settings is global cli settings var Settings = struct { // Verbose toggles verbose output for commands. Verbose bool }{} // Command creates a new command. func Command...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/embedded/embed.go
embedded/embed.go
package embedded import ( "embed" ) //go:embed network k3s defaults images var fs embed.FS // FS returns the underlying embed.FS func FS() embed.FS { return fs } func read(file string) ([]byte, error) { return fs.ReadFile(file) } // Read reads the content of file func Read(file string) ([]byte, error) { return re...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/daemon/daemon.go
daemon/daemon.go
package daemon import ( "context" "fmt" "github.com/abiosoft/colima/cli" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/daemon/process" "github.com/abiosoft/colima/daemon/process/inotify" "github.com/abiosoft/colima/daemon/process/vmnet" "github.com/abiosoft/colima/environment" "github.com/a...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/daemon/process/process.go
daemon/process/process.go
package process import ( "context" "fmt" "path/filepath" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/environment" ) func CtxKeyDaemon() any { return struct{ key string }{key: "colima_daemon"} } // Process is a background process managed by the daemon. type Process interface { // Name for ...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/daemon/process/vmnet/deps.go
daemon/process/vmnet/deps.go
package vmnet import ( "bytes" "fmt" "os" "path/filepath" "runtime" "strings" "github.com/abiosoft/colima/daemon/process" "github.com/abiosoft/colima/embedded" "github.com/abiosoft/colima/environment" ) var _ process.Dependency = sudoerFile{} type sudoerFile struct{} // Installed implements Dependency fun...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/daemon/process/vmnet/vmnet.go
daemon/process/vmnet/vmnet.go
package vmnet import ( "context" "fmt" "net" "os" "os/exec" "path/filepath" "github.com/abiosoft/colima/cli" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/daemon/process" "github.com/abiosoft/colima/util/osutil" "github.com/sirupsen/logrus" ) const Name = "vmnet" const ( SubProcessEnvV...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/daemon/process/inotify/inotify.go
daemon/process/inotify/inotify.go
package inotify import ( "context" "fmt" "time" "github.com/abiosoft/colima/daemon/process" "github.com/abiosoft/colima/environment" "github.com/abiosoft/colima/environment/vm/lima/limautil" "github.com/sirupsen/logrus" ) const Name = "inotify" const volumesInterval = 5 * time.Second type Args struct { envi...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/daemon/process/inotify/watch.go
daemon/process/inotify/watch.go
package inotify import ( "context" "fmt" "os" "github.com/abiosoft/colima/util" "github.com/rjeczalik/notify" "github.com/sirupsen/logrus" ) type dirWatcher interface { // Watch watches directories recursively for changes and sends message via c on // modifications to files within the watched directories. /...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/daemon/process/inotify/volumes_test.go
daemon/process/inotify/volumes_test.go
package inotify import ( "reflect" "strconv" "testing" ) func Test_omitChildrenDirectories(t *testing.T) { tests := []struct { args []string want []string }{ { args: []string{"/", "/user", "/user/someone", "/a", "/a/ee", "/a/bb"}, want: []string{"/"}, }, { args: []string{"/someone", "/user", "...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/daemon/process/inotify/volumes.go
daemon/process/inotify/volumes.go
package inotify import ( "bytes" "context" "encoding/json" "fmt" "sort" "strings" "time" "github.com/abiosoft/colima/environment/container/containerd" "github.com/abiosoft/colima/environment/container/docker" ) func (f *inotifyProcess) monitorContainerVolumes(ctx context.Context, c chan<- []string) error { ...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
abiosoft/colima
https://github.com/abiosoft/colima/blob/fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81/daemon/process/inotify/events.go
daemon/process/inotify/events.go
package inotify import ( "context" "fmt" "io/fs" "time" ) type modEvent struct { path string // filename fs.FileMode } func (m modEvent) Mode() string { return fmt.Sprintf("%o", m.FileMode) } func (f *inotifyProcess) handleEvents(ctx context.Context, watcher dirWatcher) error { log := f.log log.Trace("begin...
go
MIT
fe8de6ef3d36d4d0fb385cb26c63ffbe34ec9d81
2026-01-07T08:37:23.316020Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/process/process_test.go
pkg/process/process_test.go
package process import ( "fmt" "os" "os/exec" "runtime" "testing" ) func TestAlive(t *testing.T) { for _, pid := range []int{0, -1, -123} { t.Run(fmt.Sprintf("invalid process (%d)", pid), func(t *testing.T) { if Alive(pid) { t.Errorf("PID %d should not be alive", pid) } }) } t.Run("current proce...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/process/process_linux.go
pkg/process/process_linux.go
package process import ( "bytes" "fmt" "os" ) func zombie(pid int) (bool, error) { if pid < 1 { return false, nil } data, err := os.ReadFile(fmt.Sprintf("/proc/%d/stat", pid)) if err != nil { if os.IsNotExist(err) { return false, nil } return false, err } if cols := bytes.SplitN(data, []byte(" "),...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/process/process_windows.go
pkg/process/process_windows.go
package process import ( "os" "golang.org/x/sys/windows" ) func alive(pid int) bool { h, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid)) if err != nil { return false } var c uint32 err = windows.GetExitCodeProcess(h, &c) _ = windows.CloseHandle(h) if err != nil { ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/process/process.go
pkg/process/process.go
package process import "fmt" // Alive returns true if process with a given pid is running. // // It only considers positive PIDs; 0 (all processes in the current process // group), -1 (all processes with a PID larger than 1), and negative (-n, // all processes in process group "n") values for pid are never considered...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/process/process_unix.go
pkg/process/process_unix.go
//go:build !windows package process import ( "errors" "os" "path/filepath" "runtime" "strconv" "golang.org/x/sys/unix" ) func alive(pid int) bool { switch runtime.GOOS { case "darwin": // macOS does not have a proc filesystem. Use kill -0 pid to judge if the // process exists. From KILL(2): https://www....
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/process/process_nolinux.go
pkg/process/process_nolinux.go
//go:build !linux package process func zombie(pid int) (bool, error) { return false, nil }
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/process/doc.go
pkg/process/doc.go
// Package process provides a set of basic functions to manage individual // processes. package process
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/useragent/useragent_test.go
pkg/useragent/useragent_test.go
package useragent import "testing" func TestVersionInfo(t *testing.T) { vi := VersionInfo{"foo", "bar"} if !vi.isValid() { t.Fatalf("VersionInfo should be valid") } vi = VersionInfo{"", "bar"} if vi.isValid() { t.Fatalf("Expected VersionInfo to be invalid") } vi = VersionInfo{"foo", ""} if vi.isValid() { ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/useragent/useragent.go
pkg/useragent/useragent.go
// Package useragent provides helper functions to pack // version information into a single User-Agent header. package useragent import ( "strings" ) // VersionInfo is used to model UserAgent versions. type VersionInfo struct { Name string Version string } func (vi *VersionInfo) isValid() bool { const stopCha...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugingetter/getter.go
pkg/plugingetter/getter.go
package plugingetter import ( "net" "time" "github.com/moby/moby/v2/pkg/plugins" ) const ( // Lookup doesn't update RefCount Lookup = 0 // Acquire increments RefCount Acquire = 1 // Release decrements RefCount Release = -1 ) // CompatPlugin is an abstraction to handle both v2(new) and v1(legacy) plugins. t...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/authorization/middleware.go
pkg/authorization/middleware.go
package authorization import ( "context" "net/http" "sync" "github.com/containerd/log" "github.com/moby/moby/v2/pkg/plugingetter" ) // Middleware uses a list of plugins to // handle authorization in the API requests. type Middleware struct { mu sync.Mutex plugins []Plugin } // NewMiddleware creates a ne...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/authorization/middleware_test.go
pkg/authorization/middleware_test.go
package authorization import ( "net/http" "net/http/httptest" "strings" "testing" "github.com/moby/moby/v2/pkg/plugingetter" "gotest.tools/v3/assert" ) func TestMiddleware(t *testing.T) { pluginNames := []string{"testPlugin1", "testPlugin2"} var pluginGetter plugingetter.PluginGetter m := NewMiddleware(plug...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/authorization/api.go
pkg/authorization/api.go
package authorization import ( "crypto/x509" "encoding/json" "encoding/pem" ) const ( // AuthZApiRequest is the url for daemon request authorization AuthZApiRequest = "AuthZPlugin.AuthZReq" // AuthZApiResponse is the url for daemon response authorization AuthZApiResponse = "AuthZPlugin.AuthZRes" // AuthZApi...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/authorization/response.go
pkg/authorization/response.go
package authorization import ( "bufio" "bytes" "context" "encoding/json" "errors" "net" "net/http" "github.com/containerd/log" ) // ResponseModifier allows authorization plugins to read and modify the content of the http.response type ResponseModifier interface { http.ResponseWriter http.Flusher // RawBo...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/authorization/middleware_unix_test.go
pkg/authorization/middleware_unix_test.go
//go:build !windows package authorization import ( "context" "net/http" "net/http/httptest" "testing" "github.com/moby/moby/v2/pkg/plugingetter" "gotest.tools/v3/assert" ) func TestMiddlewareWrapHandler(t *testing.T) { server := authZPluginTestServer{t: t} server.start() defer server.stop() authZPlugin :...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/authorization/api_test.go
pkg/authorization/api_test.go
package authorization import ( "crypto/rand" "crypto/rsa" "crypto/tls" "crypto/x509" "crypto/x509/pkix" "math/big" "net/http" "testing" "time" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" ) func TestPeerCertificateMarshalJSON(t *testing.T) { template := &x509.Certificate{ IsCA: ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/authorization/authz_unix_test.go
pkg/authorization/authz_unix_test.go
//go:build !windows // TODO Windows: This uses a Unix socket for testing. This might be possible // to port to Windows using a named pipe instead. package authorization import ( "bytes" "encoding/json" "io" "net" "net/http" "net/http/httptest" "os" "path" "reflect" "strings" "testing" "time" "github.co...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/authorization/authz.go
pkg/authorization/authz.go
package authorization import ( "bufio" "bytes" "context" "fmt" "io" "mime" "net/http" "net/url" "regexp" "strings" "github.com/containerd/log" "github.com/moby/moby/v2/pkg/ioutils" ) const maxBodySize = 1048576 // 1MB // NewCtx creates new authZ context, it is used to store authorization information rel...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/authorization/plugin.go
pkg/authorization/plugin.go
package authorization import ( "sync" "github.com/moby/moby/v2/pkg/plugingetter" "github.com/moby/moby/v2/pkg/plugins" ) // Plugin allows third party plugins to authorize requests and responses // in the context of docker API type Plugin interface { // Name returns the registered plugin name Name() string // ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/meminfo/meminfo.go
pkg/meminfo/meminfo.go
// Package meminfo provides utilities to retrieve memory statistics of // the host system. package meminfo // Read retrieves memory statistics of the host system and returns a // Memory type. It is only supported on Linux and Windows, and returns an // error on other platforms. func Read() (*Memory, error) { return r...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/meminfo/meminfo_linux.go
pkg/meminfo/meminfo_linux.go
package meminfo import ( "bufio" "io" "os" "strconv" "strings" ) // readMemInfo retrieves memory statistics of the host system and returns a // Memory type. func readMemInfo() (*Memory, error) { file, err := os.Open("/proc/meminfo") if err != nil { return nil, err } defer file.Close() return parseMemInfo(...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/meminfo/meminfo_unsupported.go
pkg/meminfo/meminfo_unsupported.go
//go:build !linux && !windows package meminfo import "errors" // readMemInfo is not supported on platforms other than linux and windows. func readMemInfo() (*Memory, error) { return nil, errors.New("platform and architecture is not supported") }
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/meminfo/meminfo_windows.go
pkg/meminfo/meminfo_windows.go
package meminfo import ( "unsafe" "golang.org/x/sys/windows" ) var ( modkernel32 = windows.NewLazySystemDLL("kernel32.dll") procGlobalMemoryStatusEx = modkernel32.NewProc("GlobalMemoryStatusEx") ) // https://msdn.microsoft.com/en-us/library/windows/desktop/aa366589(v=vs.85).aspx // https://msdn.microsoft.com/e...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/meminfo/meminfo_unix_test.go
pkg/meminfo/meminfo_unix_test.go
//go:build linux || freebsd package meminfo import ( "strings" "testing" ) // TestMemInfo tests parseMemInfo with a static meminfo string func TestMemInfo(t *testing.T) { const input = ` MemTotal: 1 kB MemFree: 2 kB MemAvailable: 3 kB SwapTotal: 4 kB SwapFree: 5 kB Malformed1: Malforme...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/homedir/homedir.go
pkg/homedir/homedir.go
package homedir import ( "os" "os/user" "runtime" ) // Get returns the home directory of the current user with the help of // environment variables depending on the target operating system. // Returned path should be used with "path/filepath" to form new paths. // // On non-Windows platforms, it falls back to nss ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/homedir/homedir_test.go
pkg/homedir/homedir_test.go
package homedir import ( "path/filepath" "testing" ) func TestGet(t *testing.T) { home := Get() if home == "" { t.Fatal("returned home directory is empty") } if !filepath.IsAbs(home) { t.Fatalf("returned path is not absolute: %s", home) } }
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/homedir/homedir_others.go
pkg/homedir/homedir_others.go
//go:build !linux package homedir import ( "errors" ) // GetRuntimeDir is unsupported on non-linux system. func GetRuntimeDir() (string, error) { return "", errors.New("homedir.GetRuntimeDir() is not supported on this system") } // StickRuntimeDirContents is unsupported on non-linux system. func StickRuntimeDirCo...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/homedir/homedir_linux.go
pkg/homedir/homedir_linux.go
package homedir import ( "errors" "os" "path/filepath" "strings" ) // GetRuntimeDir returns XDG_RUNTIME_DIR. // XDG_RUNTIME_DIR is typically configured via pam_systemd. // GetRuntimeDir returns non-nil error if XDG_RUNTIME_DIR is not set. // // See also https://standards.freedesktop.org/basedir-spec/latest/ar01s0...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/longpath/longpath_test.go
pkg/longpath/longpath_test.go
package longpath import ( "strings" "testing" ) func TestStandardLongPath(t *testing.T) { c := `C:\simple\path` longC := AddPrefix(c) if !strings.EqualFold(longC, `\\?\C:\simple\path`) { t.Errorf("Wrong long path returned. Original = %s ; Long = %s", c, longC) } } func TestUNCLongPath(t *testing.T) { c := `...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/longpath/longpath.go
pkg/longpath/longpath.go
// Package longpath introduces some constants and helper functions for handling // long paths in Windows. // // Long paths are expected to be prepended with "\\?\" and followed by either a // drive letter, a UNC server\share, or a volume identifier. package longpath import ( "os" "runtime" "strings" ) // longPathP...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/discovery_unix.go
pkg/plugins/discovery_unix.go
//go:build !windows package plugins import ( "os" "path/filepath" "github.com/moby/moby/v2/pkg/homedir" ) func rootlessConfigPluginsPath() string { if configHome, err := homedir.GetConfigHome(); err != nil { return filepath.Join(configHome, "docker/plugins") } return "/etc/docker/plugins" } func rootlessLi...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/client.go
pkg/plugins/client.go
package plugins import ( "bytes" "context" "encoding/json" "io" "net/http" "net/url" "time" "github.com/containerd/log" "github.com/docker/go-connections/sockets" "github.com/docker/go-connections/tlsconfig" "github.com/moby/moby/v2/pkg/ioutils" "github.com/moby/moby/v2/pkg/plugins/transport" ) const ( ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/discovery_unix_test.go
pkg/plugins/discovery_unix_test.go
//go:build !windows package plugins import ( "fmt" "net" "os" "path/filepath" "reflect" "testing" "gotest.tools/v3/assert" ) func TestLocalSocket(t *testing.T) { // TODO Windows: Enable a similar version for Windows named pipes tmpdir := t.TempDir() r := LocalRegistry{ socketsPath: tmpdir, specsPaths:...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/errors.go
pkg/plugins/errors.go
package plugins import ( "fmt" "net/http" ) type statusError struct { status int method string err string } // Error returns a formatted string for this error type func (e *statusError) Error() string { return fmt.Sprintf("%s: %v", e.method, e.err) } // IsNotFound indicates if the passed in error is from a...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/plugin_test.go
pkg/plugins/plugin_test.go
package plugins import ( "bytes" "encoding/json" "io" "net/http" "os" "path/filepath" "runtime" "sync" "testing" "time" "github.com/docker/go-connections/tlsconfig" "github.com/moby/moby/v2/pkg/plugins/transport" "github.com/pkg/errors" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" ) const ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/client_test.go
pkg/plugins/client_test.go
package plugins import ( "bytes" "encoding/json" "errors" "fmt" "io" "net/http" "net/http/httptest" "net/url" "strings" "testing" "time" "github.com/docker/go-connections/tlsconfig" "github.com/moby/moby/v2/pkg/plugins/transport" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" ) func setupRem...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/plugins.go
pkg/plugins/plugins.go
// Package plugins provides structures and helper functions to manage Docker // plugins. // // Docker discovers plugins by looking for them in the plugin directory whenever // a user or container tries to use one by name. UNIX domain socket files must // be located under /run/docker/plugins, whereas spec files can be l...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/discovery_windows.go
pkg/plugins/discovery_windows.go
package plugins import ( "os" "path/filepath" ) // specsPaths is the Windows implementation of [SpecsPaths]. func specsPaths() []string { return []string{filepath.Join(os.Getenv("programdata"), "docker", "plugins")} }
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/discovery.go
pkg/plugins/discovery.go
package plugins import ( "encoding/json" "io/fs" "net/url" "os" "path/filepath" "strings" "sync" "github.com/containerd/log" "github.com/moby/sys/userns" "github.com/pkg/errors" ) // ErrNotFound plugin not found var ErrNotFound = errors.New("plugin not found") const defaultSocketsPath = "/run/docker/plugi...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/discovery_test.go
pkg/plugins/discovery_test.go
package plugins import ( "os" "path/filepath" "testing" ) func TestFileSpecPlugin(t *testing.T) { tmpdir := t.TempDir() r := LocalRegistry{ socketsPath: tmpdir, specsPaths: []string{tmpdir}, } cases := []struct { path string name string addr string fail bool }{ // TODO Windows: Factor out the ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/transport/mimetype.go
pkg/plugins/transport/mimetype.go
package transport // VersionMimetype is the Content-Type the engine sends to plugins. // // For convenience, there is an alias in [github.com/moby/moby/v2/pkg/plugins.VersionMimetype]. const VersionMimetype = "application/vnd.docker.plugins.v1.2+json"
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/transport/http_test.go
pkg/plugins/transport/http_test.go
package transport import ( "io" "net/http" "testing" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" ) func TestHTTPTransport(t *testing.T) { var r io.Reader newTransport := NewHTTPTransport(&http.Transport{}, "http", "0.0.0.0") request, err := newTransport.NewRequest("", r) if err != nil { t.Fat...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/transport/http.go
pkg/plugins/transport/http.go
package transport import ( "io" "net/http" "strings" ) // HTTPTransport holds an [http.RoundTripper] // and information about the scheme and address the transport // sends request to. type HTTPTransport struct { http.RoundTripper scheme string addr string } // NewHTTPTransport creates a new HTTPTransport. fu...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/pluginrpc-gen/parser.go
pkg/plugins/pluginrpc-gen/parser.go
package main import ( "errors" "fmt" "go/ast" "go/parser" "go/token" "path" "reflect" "strings" "time" ) var errBadReturn = errors.New("found return arg with no name: all args must be named") type errUnexpectedType struct { expected string actual any } func (e errUnexpectedType) Error() string { retur...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/pluginrpc-gen/parser_test.go
pkg/plugins/pluginrpc-gen/parser_test.go
package main import ( "fmt" "path/filepath" "runtime" "strings" "testing" ) const testFixture = "fixtures/foo.go" func TestParseEmptyInterface(t *testing.T) { pkg, err := Parse(testFixture, "Fooer") if err != nil { t.Fatal(err) } assertName(t, "foo", pkg.Name) assertNum(t, 0, len(pkg.Functions)) } func...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/pluginrpc-gen/template_test.go
pkg/plugins/pluginrpc-gen/template_test.go
package main import ( "testing" "time" ) func TestGoduration(t *testing.T) { tests := []struct { input time.Duration expected string }{ {2 * time.Hour, "2 * time.Hour"}, {5 * time.Minute, "5 * time.Minute"}, {10 * time.Second, "10 * time.Second"}, {1500 * time.Millisecond, "1 * time.Second"}, // Wi...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/pluginrpc-gen/template.go
pkg/plugins/pluginrpc-gen/template.go
package main import ( "fmt" "strings" "text/template" "time" ) func printArgs(args []fnArg) string { var argStr []string for _, arg := range args { argStr = append(argStr, arg.String()) } return strings.Join(argStr, ", ") } func buildImports(specs []importSpec) string { var imports strings.Builder import...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/pluginrpc-gen/main.go
pkg/plugins/pluginrpc-gen/main.go
package main import ( "bytes" "errors" "flag" "fmt" "go/format" "os" "unicode" "unicode/utf8" ) type stringSet struct { values map[string]struct{} } func (s stringSet) String() string { return "" } func (s stringSet) Set(value string) error { s.values[value] = struct{}{} return nil } func (s stringSet)...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/pluginrpc-gen/fixtures/foo.go
pkg/plugins/pluginrpc-gen/fixtures/foo.go
package foo import ( aliasedio "io" "github.com/moby/moby/v2/pkg/plugins/pluginrpc-gen/fixtures/otherfixture" ) type wobble struct { Some string Val string Inception *wobble } // Fooer is an empty interface used for tests. type Fooer interface{} //nolint:revive // any Alias is not supported yet // ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/plugins/pluginrpc-gen/fixtures/otherfixture/spaceship.go
pkg/plugins/pluginrpc-gen/fixtures/otherfixture/spaceship.go
package otherfixture // Spaceship is a fixture for tests type Spaceship struct{}
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/ioutils/readers_test.go
pkg/ioutils/readers_test.go
package ioutils import ( "context" "errors" "io" "strings" "testing" "time" ) func TestReadCloserWrapperClose(t *testing.T) { const text = "hello world" testErr := errors.New("this will be called when closing") wrapper := NewReadCloserWrapper(strings.NewReader(text), func() error { return testErr }) buf...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/ioutils/readers.go
pkg/ioutils/readers.go
package ioutils import ( "context" "io" "runtime/debug" "sync/atomic" "github.com/containerd/log" ) // readCloserWrapper wraps an io.Reader, and implements an io.ReadCloser // It calls the given callback function when closed. It should be constructed // with NewReadCloserWrapper type readCloserWrapper struct { ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/ioutils/writers_test.go
pkg/ioutils/writers_test.go
package ioutils import ( "bytes" "testing" ) func TestWriteCloserWrapperClose(t *testing.T) { called := false writer := bytes.NewBuffer([]byte{}) wrapper := NewWriteCloserWrapper(writer, func() error { called = true return nil }) if err := wrapper.Close(); err != nil { t.Fatal(err) } if !called { t.F...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/ioutils/writers.go
pkg/ioutils/writers.go
package ioutils import ( "io" "sync/atomic" ) type writeCloserWrapper struct { io.Writer closer func() error closed atomic.Bool } func (r *writeCloserWrapper) Close() error { if !r.closed.CompareAndSwap(false, true) { subsequentCloseWarn("WriteCloserWrapper") return nil } return r.closer() } // NewWrite...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/ioutils/writeflusher.go
pkg/ioutils/writeflusher.go
package ioutils import ( "io" "sync" ) // WriteFlusher wraps the Write and Flush operation ensuring that every write // is a flush. In addition, the Close method can be called to intercept // Read/Write calls if the targets lifecycle has already ended. type WriteFlusher struct { w io.Writer flusher ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/tailfile/tailfile_test.go
pkg/tailfile/tailfile_test.go
package tailfile import ( "bufio" "bytes" "context" "errors" "fmt" "io" "os" "strings" "testing" "gotest.tools/v3/assert" ) func TestTailFile(t *testing.T) { f, err := os.CreateTemp("", "tail-test") if err != nil { t.Fatal(err) } defer f.Close() defer os.RemoveAll(f.Name()) testFile := []byte(`firs...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/tailfile/tailfile.go
pkg/tailfile/tailfile.go
// Package tailfile provides helper functions to read the nth lines of any // ReadSeeker. package tailfile import ( "bufio" "bytes" "context" "errors" "io" "os" ) const blockSize = 1024 var eol = []byte("\n") // ErrNonPositiveLinesNumber is an error returned if the lines number was negative. var ErrNonPositiv...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/tailfile/fuzz_test.go
pkg/tailfile/fuzz_test.go
package tailfile import ( "os" "path/filepath" "testing" fuzz "github.com/AdaLogics/go-fuzz-headers" ) func FuzzTailfile(f *testing.F) { f.Fuzz(func(t *testing.T, data []byte) { if len(data) < 5 { return } ff := fuzz.NewConsumer(data) n, err := ff.GetUint64() if err != nil { return } fileByt...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/pools/pools_test.go
pkg/pools/pools_test.go
package pools import ( "bufio" "bytes" "io" "strings" "testing" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" ) func TestBufioReaderPoolGetWithNoReaderShouldCreateOne(t *testing.T) { reader := BufioReader32KPool.Get(nil) if reader == nil { t.Fatalf("BufioReaderPool should have create a bufio.Re...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/pools/pools.go
pkg/pools/pools.go
// Package pools provides a collection of pools which provide various // data types with buffers. These can be used to lower the number of // memory allocations and reuse buffers. // // New pools should be added to this package to allow them to be // shared across packages. // // Utility functions which operate on pool...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/pidfile/pidfile_test.go
pkg/pidfile/pidfile_test.go
package pidfile import ( "errors" "os" "os/exec" "path/filepath" "runtime" "strconv" "testing" ) func TestWrite(t *testing.T) { path := filepath.Join(t.TempDir(), "testfile") err := Write(path, 0) if err == nil { t.Fatal("writing PID < 1 should fail") } err = Write(path, os.Getpid()) if err != nil { ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/pidfile/pidfile.go
pkg/pidfile/pidfile.go
// Package pidfile provides structure and helper functions to create and remove // PID file. A PID file is usually a file used to store the process ID of a // running process. package pidfile import ( "bytes" "fmt" "os" "strconv" "github.com/moby/moby/v2/pkg/process" ) // Read reads the "PID file" at path, and ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/sysinfo/sysinfo.go
pkg/sysinfo/sysinfo.go
// Package sysinfo stores information about which features a kernel supports. package sysinfo // Opt for New(). type Opt func(info *SysInfo) // SysInfo stores information about which features a kernel supports. // TODO Windows: Factor out platform specific capabilities. type SysInfo struct { // Whether the kernel su...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/sysinfo/sysinfo_linux_test.go
pkg/sysinfo/sysinfo_linux_test.go
package sysinfo import ( "os" "path/filepath" "reflect" "testing" "github.com/containerd/containerd/v2/pkg/seccomp" ) func TestReadProcBool(t *testing.T) { tmpDir := t.TempDir() procFile := filepath.Join(tmpDir, "read-proc-bool") if err := os.WriteFile(procFile, []byte("1"), 0o644); err != nil { t.Fatal(e...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false
moby/moby
https://github.com/moby/moby/blob/015cd3d3fdf4a1ad9f27f132013bea7838da721b/pkg/sysinfo/sysinfo_linux.go
pkg/sysinfo/sysinfo_linux.go
package sysinfo import ( "context" "fmt" "os" "path" "strconv" "strings" "sync" "github.com/containerd/cgroups/v3" "github.com/containerd/cgroups/v3/cgroup1" "github.com/containerd/containerd/v2/pkg/seccomp" "github.com/containerd/log" "github.com/moby/sys/mountinfo" ) var ( readMountinfoOnce sync.Once ...
go
Apache-2.0
015cd3d3fdf4a1ad9f27f132013bea7838da721b
2026-01-07T08:35:43.425641Z
false