diff --git a/README.md b/README.md new file mode 100644 index 0000000..286c5fd --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +pkg/ is a collection of utility packages started by the Docker project without being specific to its internals. + +Utility packages are kept separate from the docker core codebase to keep it as small and concise as possible. +If some utilities grow larger and their APIs stabilize, they may be moved to their own repository under the +Docker organization, to facilitate re-use by other projects. However that is not the priority. + +The `pkg` name is after the same directory in the camlistore project. Since Brad is a core +Go maintainer, we thought it made sense to copy his methods for organizing Go code :) Thanks Brad! + +Because utility packages are small and neatly separated from the rest of the codebase, they are a good +place to start for aspiring maintainers and contributors. Get in touch if you want to help maintain them! diff --git a/archive/archive.go b/archive/archive.go index 1b78830..4fca939 100644 --- a/archive/archive.go +++ b/archive/archive.go @@ -18,12 +18,12 @@ import ( "syscall" "github.com/Sirupsen/logrus" - "github.com/containers/storage/pkg/fileutils" - "github.com/containers/storage/pkg/idtools" - "github.com/containers/storage/pkg/ioutils" - "github.com/containers/storage/pkg/pools" - "github.com/containers/storage/pkg/promise" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/fileutils" + "github.com/containers/pkg/idtools" + "github.com/containers/pkg/ioutils" + "github.com/containers/pkg/pools" + "github.com/containers/pkg/promise" + "github.com/containers/pkg/system" ) type ( diff --git a/archive/archive_linux.go b/archive/archive_linux.go index e944ca2..487e4c2 100644 --- a/archive/archive_linux.go +++ b/archive/archive_linux.go @@ -7,7 +7,7 @@ import ( "strings" "syscall" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/system" ) func getWhiteoutConverter(format WhiteoutFormat) tarWhiteoutConverter { diff --git a/archive/archive_unix.go b/archive/archive_unix.go index 19d731f..05cbfe6 100644 --- a/archive/archive_unix.go +++ b/archive/archive_unix.go @@ -9,7 +9,7 @@ import ( "path/filepath" "syscall" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/system" ) // fixVolumePathPrefix does platform specific processing to ensure that if diff --git a/archive/archive_unix_test.go b/archive/archive_unix_test.go index 4bf0ae2..eee1680 100644 --- a/archive/archive_unix_test.go +++ b/archive/archive_unix_test.go @@ -11,7 +11,7 @@ import ( "syscall" "testing" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/system" ) func TestCanonicalTarNameForPath(t *testing.T) { diff --git a/archive/archive_windows.go b/archive/archive_windows.go index 828d3b9..71495fa 100644 --- a/archive/archive_windows.go +++ b/archive/archive_windows.go @@ -9,7 +9,7 @@ import ( "path/filepath" "strings" - "github.com/containers/storage/pkg/longpath" + "github.com/containers/pkg/longpath" ) // fixVolumePathPrefix does platform specific processing to ensure that if diff --git a/archive/changes.go b/archive/changes.go index 234b0a6..3d12b03 100644 --- a/archive/changes.go +++ b/archive/changes.go @@ -14,9 +14,9 @@ import ( "time" "github.com/Sirupsen/logrus" - "github.com/containers/storage/pkg/idtools" - "github.com/containers/storage/pkg/pools" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/idtools" + "github.com/containers/pkg/pools" + "github.com/containers/pkg/system" ) // ChangeType represents the change type. diff --git a/archive/changes_linux.go b/archive/changes_linux.go index 798d7bf..169f4dc 100644 --- a/archive/changes_linux.go +++ b/archive/changes_linux.go @@ -9,7 +9,7 @@ import ( "syscall" "unsafe" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/system" ) // walker is used to implement collectFileInfoForChanges on linux. Where this diff --git a/archive/changes_other.go b/archive/changes_other.go index e1d1e7a..f25e8b4 100644 --- a/archive/changes_other.go +++ b/archive/changes_other.go @@ -9,7 +9,7 @@ import ( "runtime" "strings" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/system" ) func collectFileInfoForChanges(oldDir, newDir string) (*FileInfo, *FileInfo, error) { diff --git a/archive/changes_test.go b/archive/changes_test.go index f19c9fd..7d45ace 100644 --- a/archive/changes_test.go +++ b/archive/changes_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/system" ) func max(x, y int) int { diff --git a/archive/changes_unix.go b/archive/changes_unix.go index 43dd94e..bf4c664 100644 --- a/archive/changes_unix.go +++ b/archive/changes_unix.go @@ -6,7 +6,7 @@ import ( "os" "syscall" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/system" ) func statDifferent(oldStat *system.StatT, newStat *system.StatT) bool { diff --git a/archive/changes_windows.go b/archive/changes_windows.go index 06eadd6..b8cab3e 100644 --- a/archive/changes_windows.go +++ b/archive/changes_windows.go @@ -3,7 +3,7 @@ package archive import ( "os" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/system" ) func statDifferent(oldStat *system.StatT, newStat *system.StatT) bool { diff --git a/archive/copy.go b/archive/copy.go index 05c243d..488d0a1 100644 --- a/archive/copy.go +++ b/archive/copy.go @@ -10,7 +10,7 @@ import ( "strings" "github.com/Sirupsen/logrus" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/system" ) // Errors used or returned by this file. diff --git a/archive/diff.go b/archive/diff.go index c8d09d3..a53c229 100644 --- a/archive/diff.go +++ b/archive/diff.go @@ -11,9 +11,9 @@ import ( "strings" "github.com/Sirupsen/logrus" - "github.com/containers/storage/pkg/idtools" - "github.com/containers/storage/pkg/pools" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/idtools" + "github.com/containers/pkg/pools" + "github.com/containers/pkg/system" ) // UnpackLayer unpack `layer` to a `dest`. The stream `layer` can be diff --git a/archive/diff_test.go b/archive/diff_test.go index b6f654b..f76511f 100644 --- a/archive/diff_test.go +++ b/archive/diff_test.go @@ -10,7 +10,7 @@ import ( "runtime" "testing" - "github.com/containers/storage/pkg/ioutils" + "github.com/containers/pkg/ioutils" ) func TestApplyLayerInvalidFilenames(t *testing.T) { diff --git a/archive/example_changes.go b/archive/example_changes.go index 549f07f..e4f2024 100644 --- a/archive/example_changes.go +++ b/archive/example_changes.go @@ -14,7 +14,7 @@ import ( "path" "github.com/Sirupsen/logrus" - "github.com/containers/storage/pkg/archive" + "github.com/containers/pkg/archive" ) var ( diff --git a/chrootarchive/archive.go b/chrootarchive/archive.go index 649575c..db9aa5e 100644 --- a/chrootarchive/archive.go +++ b/chrootarchive/archive.go @@ -7,8 +7,8 @@ import ( "os" "path/filepath" - "github.com/containers/storage/pkg/archive" - "github.com/containers/storage/pkg/idtools" + "github.com/containers/pkg/archive" + "github.com/containers/pkg/idtools" ) var chrootArchiver = &archive.Archiver{Untar: Untar} diff --git a/chrootarchive/archive_test.go b/chrootarchive/archive_test.go index 4a9b011..d7ea1d6 100644 --- a/chrootarchive/archive_test.go +++ b/chrootarchive/archive_test.go @@ -13,9 +13,9 @@ import ( "testing" "time" - "github.com/containers/storage/pkg/archive" - "github.com/containers/storage/pkg/reexec" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/archive" + "github.com/containers/pkg/reexec" + "github.com/containers/pkg/system" ) func init() { diff --git a/chrootarchive/archive_unix.go b/chrootarchive/archive_unix.go index e04ed78..43a6c89 100644 --- a/chrootarchive/archive_unix.go +++ b/chrootarchive/archive_unix.go @@ -12,8 +12,8 @@ import ( "os" "runtime" - "github.com/containers/storage/pkg/archive" - "github.com/containers/storage/pkg/reexec" + "github.com/containers/pkg/archive" + "github.com/containers/pkg/reexec" ) // untar is the entry-point for storage-untar on re-exec. This is not used on diff --git a/chrootarchive/archive_windows.go b/chrootarchive/archive_windows.go index 93fde42..9662d25 100644 --- a/chrootarchive/archive_windows.go +++ b/chrootarchive/archive_windows.go @@ -3,8 +3,8 @@ package chrootarchive import ( "io" - "github.com/containers/storage/pkg/archive" - "github.com/containers/storage/pkg/longpath" + "github.com/containers/pkg/archive" + "github.com/containers/pkg/longpath" ) // chroot is not supported by Windows diff --git a/chrootarchive/chroot_linux.go b/chrootarchive/chroot_linux.go index 54b5ff4..d3e7c45 100644 --- a/chrootarchive/chroot_linux.go +++ b/chrootarchive/chroot_linux.go @@ -7,7 +7,7 @@ import ( "path/filepath" "syscall" - "github.com/containers/storage/pkg/mount" + "github.com/containers/pkg/mount" ) // chroot on linux uses pivot_root instead of chroot diff --git a/chrootarchive/diff.go b/chrootarchive/diff.go index 377aeb9..0c3e1da 100644 --- a/chrootarchive/diff.go +++ b/chrootarchive/diff.go @@ -1,6 +1,6 @@ package chrootarchive -import "github.com/containers/storage/pkg/archive" +import "github.com/containers/pkg/archive" // ApplyLayer parses a diff in the standard layer format from `layer`, // and applies it to the directory `dest`. The stream `layer` can only be diff --git a/chrootarchive/diff_unix.go b/chrootarchive/diff_unix.go index 3a9f9a8..7c79c8d 100644 --- a/chrootarchive/diff_unix.go +++ b/chrootarchive/diff_unix.go @@ -12,9 +12,9 @@ import ( "path/filepath" "runtime" - "github.com/containers/storage/pkg/archive" - "github.com/containers/storage/pkg/reexec" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/archive" + "github.com/containers/pkg/reexec" + "github.com/containers/pkg/system" ) type applyLayerResponse struct { diff --git a/chrootarchive/diff_windows.go b/chrootarchive/diff_windows.go index 534d270..5a1a340 100644 --- a/chrootarchive/diff_windows.go +++ b/chrootarchive/diff_windows.go @@ -6,8 +6,8 @@ import ( "os" "path/filepath" - "github.com/containers/storage/pkg/archive" - "github.com/containers/storage/pkg/longpath" + "github.com/containers/pkg/archive" + "github.com/containers/pkg/longpath" ) // applyLayerHandler parses a diff in the standard layer format from `layer`, and diff --git a/chrootarchive/init_unix.go b/chrootarchive/init_unix.go index 21cd879..e5e8532 100644 --- a/chrootarchive/init_unix.go +++ b/chrootarchive/init_unix.go @@ -8,7 +8,7 @@ import ( "io/ioutil" "os" - "github.com/containers/storage/pkg/reexec" + "github.com/containers/pkg/reexec" ) func init() { diff --git a/idtools/idtools_unix.go b/idtools/idtools_unix.go index b2cfb05..0289f91 100644 --- a/idtools/idtools_unix.go +++ b/idtools/idtools_unix.go @@ -6,7 +6,7 @@ import ( "os" "path/filepath" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/system" ) func mkdirAs(path string, mode os.FileMode, ownerUID, ownerGID int, mkAll, chownExisting bool) error { diff --git a/idtools/idtools_windows.go b/idtools/idtools_windows.go index 0cad173..6e58e9e 100644 --- a/idtools/idtools_windows.go +++ b/idtools/idtools_windows.go @@ -5,7 +5,7 @@ package idtools import ( "os" - "github.com/containers/storage/pkg/system" + "github.com/containers/pkg/system" ) // Platforms such as Windows do not support the UID/GID concept. So make this diff --git a/integration/utils.go b/integration/utils.go index 806d611..0604e65 100644 --- a/integration/utils.go +++ b/integration/utils.go @@ -15,7 +15,7 @@ import ( "syscall" "time" - "github.com/containers/storage/pkg/stringutils" + "github.com/containers/pkg/stringutils" ) // GetExitCode returns the ExitStatus of the specified error if its type is diff --git a/ioutils/temp_windows.go b/ioutils/temp_windows.go index c719c12..611ff77 100644 --- a/ioutils/temp_windows.go +++ b/ioutils/temp_windows.go @@ -5,7 +5,7 @@ package ioutils import ( "io/ioutil" - "github.com/containers/storage/pkg/longpath" + "github.com/containers/pkg/longpath" ) // TempDir is the equivalent of ioutil.TempDir, except that the result is in Windows longpath format. diff --git a/mflag/example/example.go b/mflag/example/example.go index 0911d09..384a1ca 100644 --- a/mflag/example/example.go +++ b/mflag/example/example.go @@ -3,7 +3,7 @@ package main import ( "fmt" - flag "github.com/containers/storage/pkg/mflag" + flag "github.com/containers/pkg/mflag" ) var ( diff --git a/mflag/flag.go b/mflag/flag.go index e4ce141..2f8ad5d 100644 --- a/mflag/flag.go +++ b/mflag/flag.go @@ -9,7 +9,7 @@ // Define flags using flag.String(), Bool(), Int(), etc. // // This declares an integer flag, -f or --flagname, stored in the pointer ip, with type *int. -// import "flag /github.com/containers/storage/pkg/mflag" +// import "flag /github.com/containers/pkg/mflag" // var ip = flag.Int([]string{"f", "-flagname"}, 1234, "help message for flagname") // If you like, you can bind the flag to a variable using the Var() functions. // var flagvar int @@ -92,7 +92,7 @@ import ( "text/tabwriter" "time" - "github.com/containers/storage/pkg/homedir" + "github.com/containers/pkg/homedir" ) // ErrHelp is the error returned if the flag -help is invoked but no such flag is defined. diff --git a/plugins/client.go b/plugins/client.go index a8865a0..cc89c12 100644 --- a/plugins/client.go +++ b/plugins/client.go @@ -10,7 +10,7 @@ import ( "time" "github.com/Sirupsen/logrus" - "github.com/containers/storage/pkg/plugins/transport" + "github.com/containers/pkg/plugins/transport" "github.com/docker/go-connections/sockets" "github.com/docker/go-connections/tlsconfig" ) diff --git a/plugins/client_test.go b/plugins/client_test.go index 56b3d71..e08cb98 100644 --- a/plugins/client_test.go +++ b/plugins/client_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/containers/storage/pkg/plugins/transport" + "github.com/containers/pkg/plugins/transport" "github.com/docker/go-connections/tlsconfig" ) diff --git a/plugins/pluginrpc-gen/fixtures/foo.go b/plugins/pluginrpc-gen/fixtures/foo.go index 642cefe..5a0e03c 100644 --- a/plugins/pluginrpc-gen/fixtures/foo.go +++ b/plugins/pluginrpc-gen/fixtures/foo.go @@ -5,7 +5,7 @@ import ( aliasedio "io" - "github.com/containers/storage/pkg/plugins/pluginrpc-gen/fixtures/otherfixture" + "github.com/containers/pkg/plugins/pluginrpc-gen/fixtures/otherfixture" ) var ( diff --git a/pools/pools.go b/pools/pools.go index a15e368..bf63183 100644 --- a/pools/pools.go +++ b/pools/pools.go @@ -14,7 +14,7 @@ import ( "io" "sync" - "github.com/containers/storage/pkg/ioutils" + "github.com/containers/pkg/ioutils" ) var ( diff --git a/stringid/stringid.go b/stringid/stringid.go index 74dfaaa..2ca4587 100644 --- a/stringid/stringid.go +++ b/stringid/stringid.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - "github.com/containers/storage/pkg/random" + "github.com/containers/pkg/random" ) const shortLen = 12 diff --git a/stringutils/stringutils.go b/stringutils/stringutils.go index 078ceaf..e9e2ae5 100644 --- a/stringutils/stringutils.go +++ b/stringutils/stringutils.go @@ -6,7 +6,7 @@ import ( "math/rand" "strings" - "github.com/containers/storage/pkg/random" + "github.com/containers/pkg/random" ) // GenerateRandomAlphaOnlyString generates an alphabetical random string with length n.