diff --git a/Makefile b/Makefile index 2a87d5fc..9a302e2f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROJECT := github.com/juju/utils/v3 +PROJECT := github.com/juju/utils/v4 .PHONY: check-licence check-go check diff --git a/arch/arch.go b/arch/arch.go deleted file mode 100644 index 765e17ba..00000000 --- a/arch/arch.go +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2014-2016 Canonical Ltd. -// Licensed under the LGPLv3, see LICENCE file for details. - -package arch - -import ( - "regexp" - "runtime" - "strings" -) - -// The following constants define the machine architectures supported by Juju. -const ( - AMD64 = "amd64" - I386 = "i386" - ARM = "armhf" - ARM64 = "arm64" - PPC64EL = "ppc64el" - S390X = "s390x" - RISCV64 = "riscv64" - - // Older versions of Juju used "ppc64" instead of ppc64el - LEGACY_PPC64 = "ppc64" -) - -// AllSupportedArches records the machine architectures recognised by Juju. -var AllSupportedArches = []string{ - AMD64, - I386, - ARM, - ARM64, - PPC64EL, - S390X, - RISCV64, -} - -// Info records the information regarding each architecture recognised by Juju. -var Info = map[string]ArchInfo{ - AMD64: {64}, - I386: {32}, - ARM: {32}, - ARM64: {64}, - PPC64EL: {64}, - S390X: {64}, - RISCV64: {64}, -} - -// ArchInfo is a struct containing information about a supported architecture. -type ArchInfo struct { - // WordSize is the architecture's word size, in bits. - WordSize int -} - -// archREs maps regular expressions for matching -// `uname -m` to architectures recognised by Juju. -var archREs = []struct { - *regexp.Regexp - arch string -}{ - {regexp.MustCompile("amd64|x86_64"), AMD64}, - {regexp.MustCompile("i?[3-9]86"), I386}, - {regexp.MustCompile("(arm$)|(armv.*)"), ARM}, - {regexp.MustCompile("aarch64"), ARM64}, - {regexp.MustCompile("ppc64|ppc64el|ppc64le"), PPC64EL}, - {regexp.MustCompile("s390x"), S390X}, - {regexp.MustCompile("riscv64|risc$|risc-[vV]64"), RISCV64}, -} - -// Override for testing. -var HostArch = hostArch - -// hostArch returns the Juju architecture of the machine on which it is run. -func hostArch() string { - return NormaliseArch(runtime.GOARCH) -} - -// NormaliseArch returns the Juju architecture corresponding to a machine's -// reported architecture. The Juju architecture is used to filter simple -// streams lookup of tools and images. -func NormaliseArch(rawArch string) string { - rawArch = strings.TrimSpace(rawArch) - for _, re := range archREs { - if re.Match([]byte(rawArch)) { - return re.arch - } - } - return rawArch -} - -// IsSupportedArch returns true if arch is one supported by Juju. -func IsSupportedArch(arch string) bool { - for _, a := range AllSupportedArches { - if a == arch { - return true - } - } - return false -} diff --git a/arch/arch_test.go b/arch/arch_test.go deleted file mode 100644 index b16c2f15..00000000 --- a/arch/arch_test.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2014 Canonical Ltd. -// Licensed under the LGPLv3, see LICENCE file for details. - -package arch_test - -import ( - jc "github.com/juju/testing/checkers" - gc "gopkg.in/check.v1" - - "github.com/juju/utils/v3/arch" -) - -type archSuite struct { -} - -var _ = gc.Suite(&archSuite{}) - -func (s *archSuite) TestHostArch(c *gc.C) { - a := arch.HostArch() - c.Assert(arch.IsSupportedArch(a), jc.IsTrue) -} - -func (s *archSuite) TestNormaliseArch(c *gc.C) { - for _, test := range []struct { - raw string - arch string - }{ - {"windows", "windows"}, - {"amd64", "amd64"}, - {"x86_64", "amd64"}, - {"386", "i386"}, - {"i386", "i386"}, - {"i486", "i386"}, - {"arm", "armhf"}, - {"armv", "armhf"}, - {"armv7", "armhf"}, - {"aarch64", "arm64"}, - {"arm64", "arm64"}, - {"ppc64el", "ppc64el"}, - {"ppc64le", "ppc64el"}, - {"ppc64", "ppc64el"}, - {"s390x", "s390x"}, - {"riscv64", "riscv64"}, - {"risc", "riscv64"}, - {"risc-v64", "riscv64"}, - {"risc-V64", "riscv64"}, - } { - arch := arch.NormaliseArch(test.raw) - c.Check(arch, gc.Equals, test.arch) - } -} - -func (s *archSuite) TestIsSupportedArch(c *gc.C) { - for _, a := range arch.AllSupportedArches { - c.Assert(arch.IsSupportedArch(a), jc.IsTrue) - } - c.Assert(arch.IsSupportedArch("invalid"), jc.IsFalse) -} - -func (s *archSuite) TestArchInfo(c *gc.C) { - for _, a := range arch.AllSupportedArches { - _, ok := arch.Info[a] - c.Assert(ok, jc.IsTrue) - } -} diff --git a/arch/package_test.go b/arch/package_test.go deleted file mode 100644 index c55becbc..00000000 --- a/arch/package_test.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 Canonical Ltd. -// Licensed under the LGPLv3, see LICENCE file for details. - -package arch_test - -import ( - "testing" - - gc "gopkg.in/check.v1" -) - -func Test(t *testing.T) { - gc.TestingT(t) -} diff --git a/attempt_test.go b/attempt_test.go index 17f5dbb7..5371f8ef 100644 --- a/attempt_test.go +++ b/attempt_test.go @@ -8,7 +8,7 @@ import ( gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) func doSomething() (int, error) { return 0, nil } diff --git a/bzr/bzr_test.go b/bzr/bzr_test.go index 42bcd9cc..cd1773c3 100644 --- a/bzr/bzr_test.go +++ b/bzr/bzr_test.go @@ -15,7 +15,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/bzr" + "github.com/juju/utils/v4/bzr" ) func Test(t *stdtesting.T) { diff --git a/cache/cache_test.go b/cache/cache_test.go index a1a05111..3619dc01 100644 --- a/cache/cache_test.go +++ b/cache/cache_test.go @@ -11,7 +11,7 @@ import ( gc "gopkg.in/check.v1" "gopkg.in/errgo.v1" - "github.com/juju/utils/v3/cache" + "github.com/juju/utils/v4/cache" ) type suite struct{} diff --git a/cert/cert_test.go b/cert/cert_test.go index 10f2638f..f80dae5a 100644 --- a/cert/cert_test.go +++ b/cert/cert_test.go @@ -13,7 +13,7 @@ import ( "time" jc "github.com/juju/testing/checkers" - "github.com/juju/utils/v3/cert" + "github.com/juju/utils/v4/cert" gc "gopkg.in/check.v1" ) diff --git a/command_test.go b/command_test.go index 4504642f..ef8698d6 100644 --- a/command_test.go +++ b/command_test.go @@ -11,7 +11,7 @@ import ( "github.com/juju/testing" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type EnvironmentPatcher interface { diff --git a/context_test.go b/context_test.go index fcb1a13b..e28f188d 100644 --- a/context_test.go +++ b/context_test.go @@ -13,7 +13,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type contextSuite struct{} diff --git a/exec/exec_linux_test.go b/exec/exec_linux_test.go index 8bdcba9d..9d413133 100644 --- a/exec/exec_linux_test.go +++ b/exec/exec_linux_test.go @@ -7,7 +7,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/exec" + "github.com/juju/utils/v4/exec" ) // 0 is thrown by linux because RunParams.Wait diff --git a/exec/exec_test.go b/exec/exec_test.go index 78b05baa..22eb3a2e 100644 --- a/exec/exec_test.go +++ b/exec/exec_test.go @@ -14,7 +14,7 @@ import ( gc "gopkg.in/check.v1" "github.com/juju/clock" - "github.com/juju/utils/v3/exec" + "github.com/juju/utils/v4/exec" ) type execSuite struct { diff --git a/exec/exec_windows_test.go b/exec/exec_windows_test.go index 49adf9c2..483022cc 100644 --- a/exec/exec_windows_test.go +++ b/exec/exec_windows_test.go @@ -11,7 +11,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/exec" + "github.com/juju/utils/v4/exec" ) // 1 is thrown by powershell after the a command is cancelled diff --git a/file_test.go b/file_test.go index 081c37c2..7d4a352f 100644 --- a/file_test.go +++ b/file_test.go @@ -14,7 +14,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type fileSuite struct { diff --git a/file_unix_test.go b/file_unix_test.go index 12dbf41b..0fb52f14 100644 --- a/file_unix_test.go +++ b/file_unix_test.go @@ -15,7 +15,7 @@ import ( gc "gopkg.in/check.v1" "github.com/juju/errors" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type unixFileSuite struct { diff --git a/file_windows_test.go b/file_windows_test.go index d35f8c35..64449f4d 100644 --- a/file_windows_test.go +++ b/file_windows_test.go @@ -10,7 +10,7 @@ package utils_test import ( gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type windowsFileSuite struct { diff --git a/filepath/common_test.go b/filepath/common_test.go index 383ef6c0..fabaadfc 100644 --- a/filepath/common_test.go +++ b/filepath/common_test.go @@ -7,7 +7,7 @@ import ( "github.com/juju/testing" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/filepath" + "github.com/juju/utils/v4/filepath" ) var _ = gc.Suite(&commonSuite{}) diff --git a/filepath/filepath.go b/filepath/filepath.go index a34bf6bd..de7378ff 100644 --- a/filepath/filepath.go +++ b/filepath/filepath.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/juju/errors" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) // Renderer provides methods for the different functions in diff --git a/filepath/filepath_test.go b/filepath/filepath_test.go index 9431d8ca..be4881c0 100644 --- a/filepath/filepath_test.go +++ b/filepath/filepath_test.go @@ -9,10 +9,10 @@ import ( "github.com/juju/errors" "github.com/juju/testing" jc "github.com/juju/testing/checkers" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/filepath" + "github.com/juju/utils/v4/filepath" ) type filepathSuite struct { diff --git a/filepath/stdlib_test.go b/filepath/stdlib_test.go index b7e6df4c..1e757ac6 100644 --- a/filepath/stdlib_test.go +++ b/filepath/stdlib_test.go @@ -12,7 +12,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/filepath" + "github.com/juju/utils/v4/filepath" ) // The tests here are mostly just sanity checks against the behavior diff --git a/filepath/unix_test.go b/filepath/unix_test.go index 0659341f..4b13f8a3 100644 --- a/filepath/unix_test.go +++ b/filepath/unix_test.go @@ -10,7 +10,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/filepath" + "github.com/juju/utils/v4/filepath" ) var _ = gc.Suite(&unixSuite{}) diff --git a/filepath/win_test.go b/filepath/win_test.go index 2ddfa38b..ec1054da 100644 --- a/filepath/win_test.go +++ b/filepath/win_test.go @@ -10,7 +10,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/filepath" + "github.com/juju/utils/v4/filepath" ) var _ = gc.Suite(&windowsSuite{}) diff --git a/filestorage/fakes_test.go b/filestorage/fakes_test.go index db1c1759..dd954c49 100644 --- a/filestorage/fakes_test.go +++ b/filestorage/fakes_test.go @@ -10,7 +10,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/filestorage" + "github.com/juju/utils/v4/filestorage" ) // FakeMetadataStorage is used as a DocStorage and MetadataStorage for diff --git a/filestorage/metadata_test.go b/filestorage/metadata_test.go index bd7ddde1..74ec2951 100644 --- a/filestorage/metadata_test.go +++ b/filestorage/metadata_test.go @@ -9,7 +9,7 @@ import ( "github.com/juju/testing" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/filestorage" + "github.com/juju/utils/v4/filestorage" ) var ( diff --git a/filestorage/wrapper_test.go b/filestorage/wrapper_test.go index 9adcc0dc..d9df5e1c 100644 --- a/filestorage/wrapper_test.go +++ b/filestorage/wrapper_test.go @@ -13,7 +13,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/filestorage" + "github.com/juju/utils/v4/filestorage" ) var _ = gc.Suite(&WrapperSuite{}) diff --git a/fs/copy_test.go b/fs/copy_test.go index 809dac93..780d2b9e 100644 --- a/fs/copy_test.go +++ b/fs/copy_test.go @@ -10,7 +10,7 @@ import ( ft "github.com/juju/testing/filetesting" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/fs" + "github.com/juju/utils/v4/fs" ) type copySuite struct{} diff --git a/go.mod b/go.mod index 1698dcfa..9e705c10 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/juju/utils/v3 +module github.com/juju/utils/v4 go 1.17 @@ -35,6 +35,7 @@ require ( github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d // indirect github.com/juju/mgo/v2 v2.0.0-20210302023703-70d5d206e208 // indirect github.com/juju/retry v0.0.0-20180821225755-9058e192b216 // indirect + github.com/juju/utils/v3 v3.0.0-20220202114721-338bb0530e89 // indirect github.com/juju/version/v2 v2.0.0-20211007103408-2e8da085dc23 // indirect github.com/kr/pretty v0.2.1 // indirect github.com/kr/text v0.2.0 // indirect diff --git a/go.sum b/go.sum index 9b402733..f108bc7e 100644 --- a/go.sum +++ b/go.sum @@ -79,6 +79,7 @@ github.com/juju/utils v0.0.0-20200116185830-d40c2fe10647 h1:wQpkHVbIIpz1PCcLYku9 github.com/juju/utils v0.0.0-20200116185830-d40c2fe10647/go.mod h1:6/KLg8Wz/y2KVGWEpkK9vMNGkOnu4k/cqs8Z1fKjTOk= github.com/juju/utils/v2 v2.0.0-20200923005554-4646bfea2ef1/go.mod h1:fdlDtQlzundleLLz/ggoYinEt/LmnrpNKcNTABQATNI= github.com/juju/utils/v3 v3.0.0-20220130232349-cd7ecef0e94a/go.mod h1:LzwbbEN7buYjySp4nqnti6c6olSqRXUk6RkbSUUP1n8= +github.com/juju/utils/v3 v3.0.0-20220202114721-338bb0530e89 h1:AabsPzXjiUEs53myZfvZ62h+QZKDpsEAYKaW0IEgURU= github.com/juju/utils/v3 v3.0.0-20220202114721-338bb0530e89/go.mod h1:wf5w+8jyTh2IYnSX0sHnMJo4ZPwwuiBWn+xN3DkQg4k= github.com/juju/version v0.0.0-20161031051906-1f41e27e54f2/go.mod h1:kE8gK5X0CImdr7qpSKl3xB2PmpySSmfj7zVbkZFs81U= github.com/juju/version v0.0.0-20180108022336-b64dbd566305/go.mod h1:kE8gK5X0CImdr7qpSKl3xB2PmpySSmfj7zVbkZFs81U= diff --git a/gomaxprocs_test.go b/gomaxprocs_test.go index 6490237e..43372d93 100644 --- a/gomaxprocs_test.go +++ b/gomaxprocs_test.go @@ -9,7 +9,7 @@ import ( "github.com/juju/testing" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type gomaxprocsSuite struct { diff --git a/hash/fingerprint_test.go b/hash/fingerprint_test.go index 232c2c79..0d38d7d4 100644 --- a/hash/fingerprint_test.go +++ b/hash/fingerprint_test.go @@ -14,7 +14,7 @@ import ( "github.com/juju/testing/filetesting" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/hash" + "github.com/juju/utils/v4/hash" ) var _ = gc.Suite(&FingerprintSuite{}) diff --git a/hash/hash_test.go b/hash/hash_test.go index 55cd8c34..8250a7f8 100644 --- a/hash/hash_test.go +++ b/hash/hash_test.go @@ -14,7 +14,7 @@ import ( "github.com/juju/testing/filetesting" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/hash" + "github.com/juju/utils/v4/hash" ) var _ = gc.Suite(&HashSuite{}) diff --git a/hash/writer_test.go b/hash/writer_test.go index 69d55c3c..05c86418 100644 --- a/hash/writer_test.go +++ b/hash/writer_test.go @@ -12,7 +12,7 @@ import ( "github.com/juju/testing/filetesting" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/hash" + "github.com/juju/utils/v4/hash" ) var _ = gc.Suite(&WriterSuite{}) diff --git a/home_unix_test.go b/home_unix_test.go index 5e4fa9fa..82ad56b2 100644 --- a/home_unix_test.go +++ b/home_unix_test.go @@ -9,7 +9,7 @@ import ( "github.com/juju/testing" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type homeSuite struct { diff --git a/home_windows_test.go b/home_windows_test.go index 31f7ea6f..dcc32553 100644 --- a/home_windows_test.go +++ b/home_windows_test.go @@ -9,7 +9,7 @@ import ( "github.com/juju/testing" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type homeSuite struct { diff --git a/isubuntu_test.go b/isubuntu_test.go index a2741243..9392f859 100644 --- a/isubuntu_test.go +++ b/isubuntu_test.go @@ -11,7 +11,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type IsUbuntuSuite struct { diff --git a/jsonhttp/jsonhttp_test.go b/jsonhttp/jsonhttp_test.go index 9c0451b5..d62cfbd5 100644 --- a/jsonhttp/jsonhttp_test.go +++ b/jsonhttp/jsonhttp_test.go @@ -12,7 +12,7 @@ import ( gc "gopkg.in/check.v1" "gopkg.in/errgo.v1" - "github.com/juju/utils/v3/jsonhttp" + "github.com/juju/utils/v4/jsonhttp" ) type suite struct{} diff --git a/keyvalues/keyvalues_test.go b/keyvalues/keyvalues_test.go index a9af381e..95de84d9 100644 --- a/keyvalues/keyvalues_test.go +++ b/keyvalues/keyvalues_test.go @@ -6,7 +6,7 @@ package keyvalues_test import ( gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/keyvalues" + "github.com/juju/utils/v4/keyvalues" ) type keyValuesSuite struct{} diff --git a/limiter_test.go b/limiter_test.go index 84fbcd6e..55d68362 100644 --- a/limiter_test.go +++ b/limiter_test.go @@ -12,7 +12,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) const longWait = 10 * time.Second diff --git a/multireader_test.go b/multireader_test.go index 9f99933c..a2034e90 100644 --- a/multireader_test.go +++ b/multireader_test.go @@ -10,7 +10,7 @@ import ( "testing/iotest" jc "github.com/juju/testing/checkers" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" gc "gopkg.in/check.v1" ) diff --git a/naturalsort_test.go b/naturalsort_test.go index 2e66ff52..c3d66b94 100644 --- a/naturalsort_test.go +++ b/naturalsort_test.go @@ -9,7 +9,7 @@ import ( gc "gopkg.in/check.v1" "github.com/juju/testing" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type naturalSortSuite struct { diff --git a/network_test.go b/network_test.go index bfb77c8f..e5146f38 100644 --- a/network_test.go +++ b/network_test.go @@ -9,7 +9,7 @@ import ( "github.com/juju/testing" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type networkSuite struct { diff --git a/os_test.go b/os_test.go index 59dc4c9e..58c8fd9f 100644 --- a/os_test.go +++ b/os_test.go @@ -8,7 +8,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) var _ = gc.Suite(&osSuite{}) diff --git a/parallel/parallel_test.go b/parallel/parallel_test.go index dc6690f8..5f93c21c 100644 --- a/parallel/parallel_test.go +++ b/parallel/parallel_test.go @@ -13,7 +13,7 @@ import ( "github.com/juju/testing" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/parallel" + "github.com/juju/utils/v4/parallel" ) type parallelSuite struct { diff --git a/parallel/try_test.go b/parallel/try_test.go index c9190230..6a316241 100644 --- a/parallel/try_test.go +++ b/parallel/try_test.go @@ -15,7 +15,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/parallel" + "github.com/juju/utils/v4/parallel" ) const ( diff --git a/password_test.go b/password_test.go index 5ac7f2a7..c6b824e1 100644 --- a/password_test.go +++ b/password_test.go @@ -8,7 +8,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type passwordSuite struct { diff --git a/proxy/proxy_test.go b/proxy/proxy_test.go index a77abfa9..3bedd7d3 100644 --- a/proxy/proxy_test.go +++ b/proxy/proxy_test.go @@ -9,7 +9,7 @@ import ( "github.com/juju/testing" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/proxy" + "github.com/juju/utils/v4/proxy" ) type proxySuite struct { diff --git a/randomstring_test.go b/randomstring_test.go index 45f0f3e3..19f7e57d 100644 --- a/randomstring_test.go +++ b/randomstring_test.go @@ -7,7 +7,7 @@ package utils_test import ( "github.com/juju/testing" jc "github.com/juju/testing/checkers" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" gc "gopkg.in/check.v1" ) diff --git a/registry/registry_test.go b/registry/registry_test.go index 376358d4..2f219fe2 100644 --- a/registry/registry_test.go +++ b/registry/registry_test.go @@ -11,7 +11,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/registry" + "github.com/juju/utils/v4/registry" ) type registrySuite struct { diff --git a/relativeurl_test.go b/relativeurl_test.go index 4b1c3d08..72ef644c 100644 --- a/relativeurl_test.go +++ b/relativeurl_test.go @@ -9,7 +9,7 @@ import ( jujutesting "github.com/juju/testing" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type relativeURLSuite struct { diff --git a/setenv_test.go b/setenv_test.go index 75908a1c..6d03acd4 100644 --- a/setenv_test.go +++ b/setenv_test.go @@ -6,7 +6,7 @@ package utils_test import ( gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type SetenvSuite struct{} diff --git a/shell/bash_test.go b/shell/bash_test.go index 0bcf9bb0..d9584430 100644 --- a/shell/bash_test.go +++ b/shell/bash_test.go @@ -11,7 +11,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/shell" + "github.com/juju/utils/v4/shell" ) type bashSuite struct { diff --git a/shell/powershell.go b/shell/powershell.go index c10dc799..ad8b0876 100644 --- a/shell/powershell.go +++ b/shell/powershell.go @@ -11,7 +11,7 @@ import ( "golang.org/x/text/encoding/unicode" "github.com/juju/errors" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) // PowershellRenderer is a shell renderer for Windows Powershell. @@ -59,9 +59,10 @@ func (pr *PowershellRenderer) ScriptFilename(name, dirname string) string { // By default, winrm executes command usind cmd. Prefix the command we send over WinRM with powershell.exe. // the powershell.exe it's a program that will execute the "%s" encoded command. // A breakdown of the parameters: -// -NonInteractive - prevent any prompts from stopping the execution of the scrips -// -ExecutionPolicy - sets the execution policy for the current command, regardless of the default ExecutionPolicy on the system. -// -EncodedCommand - allows us to run a base64 encoded script. This spares us from having to quote/escape shell special characters. +// +// -NonInteractive - prevent any prompts from stopping the execution of the scrips +// -ExecutionPolicy - sets the execution policy for the current command, regardless of the default ExecutionPolicy on the system. +// -EncodedCommand - allows us to run a base64 encoded script. This spares us from having to quote/escape shell special characters. const psRemoteWrapper = "powershell.exe -Sta -NonInteractive -ExecutionPolicy RemoteSigned -EncodedCommand %s" // newEncodedPSScript returns a UTF16-LE, base64 encoded script. diff --git a/shell/powershell_test.go b/shell/powershell_test.go index 14a4e5e3..3402b554 100644 --- a/shell/powershell_test.go +++ b/shell/powershell_test.go @@ -8,7 +8,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/shell" + "github.com/juju/utils/v4/shell" ) var _ = gc.Suite(&powershellSuite{}) diff --git a/shell/renderer.go b/shell/renderer.go index b41cb968..2aed8804 100644 --- a/shell/renderer.go +++ b/shell/renderer.go @@ -8,8 +8,8 @@ import ( "strings" "github.com/juju/errors" - "github.com/juju/utils/v3" - "github.com/juju/utils/v3/filepath" + "github.com/juju/utils/v4" + "github.com/juju/utils/v4/filepath" ) // A PathRenderer generates paths that are appropriate for a given diff --git a/shell/renderer_test.go b/shell/renderer_test.go index ecde08e0..ce44c8cf 100644 --- a/shell/renderer_test.go +++ b/shell/renderer_test.go @@ -9,10 +9,10 @@ import ( "github.com/juju/errors" "github.com/juju/testing" jc "github.com/juju/testing/checkers" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/shell" + "github.com/juju/utils/v4/shell" ) type rendererSuite struct { diff --git a/shell/script.go b/shell/script.go index 4ab7860a..7dff0419 100644 --- a/shell/script.go +++ b/shell/script.go @@ -7,7 +7,7 @@ import ( "fmt" "os" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) // DumpFileOnErrorScript returns a bash script that diff --git a/shell/script_test.go b/shell/script_test.go index 8384d9b8..55949090 100644 --- a/shell/script_test.go +++ b/shell/script_test.go @@ -15,7 +15,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/shell" + "github.com/juju/utils/v4/shell" ) type scriptSuite struct { diff --git a/shell/unix.go b/shell/unix.go index 9a41e483..f3a3f9ab 100644 --- a/shell/unix.go +++ b/shell/unix.go @@ -8,8 +8,8 @@ import ( "os" "time" - "github.com/juju/utils/v3" - "github.com/juju/utils/v3/filepath" + "github.com/juju/utils/v4" + "github.com/juju/utils/v4/filepath" ) // unixRenderer is the base shell renderer for "unix" shells. diff --git a/shell/win.go b/shell/win.go index 7483a2e1..5b780c4d 100644 --- a/shell/win.go +++ b/shell/win.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/juju/utils/v3/filepath" + "github.com/juju/utils/v4/filepath" ) // windowsRenderer is the base implementation for Windows shells. diff --git a/shell/wincmd.go b/shell/wincmd.go index c280fa3a..dcdb6336 100644 --- a/shell/wincmd.go +++ b/shell/wincmd.go @@ -8,7 +8,7 @@ import ( "fmt" "os" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) // WinCmdRenderer is a shell renderer for Windows cmd.exe. diff --git a/shell/wincmd_test.go b/shell/wincmd_test.go index 4bcbfbc4..1cf0680d 100644 --- a/shell/wincmd_test.go +++ b/shell/wincmd_test.go @@ -8,7 +8,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/shell" + "github.com/juju/utils/v4/shell" ) var _ = gc.Suite(&winCmdSuite{}) diff --git a/size_test.go b/size_test.go index 51fb16fd..129361d5 100644 --- a/size_test.go +++ b/size_test.go @@ -12,7 +12,7 @@ import ( "github.com/juju/testing/filetesting" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) var _ = gc.Suite(&sizeSuite{}) diff --git a/ssh/authorisedkeys.go b/ssh/authorisedkeys.go index 3942af35..4ba12131 100644 --- a/ssh/authorisedkeys.go +++ b/ssh/authorisedkeys.go @@ -16,7 +16,7 @@ import ( "github.com/juju/errors" "github.com/juju/loggo" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" "golang.org/x/crypto/ssh" ) diff --git a/ssh/authorisedkeys_test.go b/ssh/authorisedkeys_test.go index 3e732ef5..96e84156 100644 --- a/ssh/authorisedkeys_test.go +++ b/ssh/authorisedkeys_test.go @@ -11,8 +11,8 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/ssh" - sshtesting "github.com/juju/utils/v3/ssh/testing" + "github.com/juju/utils/v4/ssh" + sshtesting "github.com/juju/utils/v4/ssh/testing" ) type AuthorisedKeysKeysSuite struct { diff --git a/ssh/clientkeys.go b/ssh/clientkeys.go index bd1b9cdf..5e2c7c6a 100644 --- a/ssh/clientkeys.go +++ b/ssh/clientkeys.go @@ -12,7 +12,7 @@ import ( "sync" "github.com/juju/collections/set" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" "golang.org/x/crypto/ssh" ) diff --git a/ssh/clientkeys_test.go b/ssh/clientkeys_test.go index 8addd505..bca37086 100644 --- a/ssh/clientkeys_test.go +++ b/ssh/clientkeys_test.go @@ -9,8 +9,8 @@ import ( gitjujutesting "github.com/juju/testing" jc "github.com/juju/testing/checkers" - "github.com/juju/utils/v3" - "github.com/juju/utils/v3/ssh" + "github.com/juju/utils/v4" + "github.com/juju/utils/v4/ssh" gc "gopkg.in/check.v1" ) diff --git a/ssh/fakes_test.go b/ssh/fakes_test.go index 1208617b..3358cf5a 100644 --- a/ssh/fakes_test.go +++ b/ssh/fakes_test.go @@ -11,7 +11,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/ssh" + "github.com/juju/utils/v4/ssh" ) type fakeClient struct { diff --git a/ssh/fingerprint_test.go b/ssh/fingerprint_test.go index 96b3bb04..e75a6bea 100644 --- a/ssh/fingerprint_test.go +++ b/ssh/fingerprint_test.go @@ -8,8 +8,8 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/ssh" - sshtesting "github.com/juju/utils/v3/ssh/testing" + "github.com/juju/utils/v4/ssh" + sshtesting "github.com/juju/utils/v4/ssh/testing" ) type FingerprintSuite struct { diff --git a/ssh/generate_test.go b/ssh/generate_test.go index b415a5e9..50487ee7 100644 --- a/ssh/generate_test.go +++ b/ssh/generate_test.go @@ -12,7 +12,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/ssh" + "github.com/juju/utils/v4/ssh" ) type GenerateSuite struct { diff --git a/ssh/run.go b/ssh/run.go index 36cc91aa..c0384442 100644 --- a/ssh/run.go +++ b/ssh/run.go @@ -12,7 +12,7 @@ import ( "github.com/juju/clock" "github.com/juju/errors" - utilexec "github.com/juju/utils/v3/exec" + utilexec "github.com/juju/utils/v4/exec" ) // ExecParams are used for the parameters for ExecuteCommandOnMachine. diff --git a/ssh/run_test.go b/ssh/run_test.go index 48ed6c3a..7830b0d5 100644 --- a/ssh/run_test.go +++ b/ssh/run_test.go @@ -14,7 +14,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/ssh" + "github.com/juju/utils/v4/ssh" ) const ( diff --git a/ssh/ssh_gocrypto.go b/ssh/ssh_gocrypto.go index 9810f646..96c4a106 100644 --- a/ssh/ssh_gocrypto.go +++ b/ssh/ssh_gocrypto.go @@ -24,7 +24,7 @@ import ( "golang.org/x/crypto/ssh/knownhosts" "golang.org/x/crypto/ssh/terminal" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) const sshDefaultPort = 22 diff --git a/ssh/ssh_gocrypto_test.go b/ssh/ssh_gocrypto_test.go index 2c8dc3a2..eb389597 100644 --- a/ssh/ssh_gocrypto_test.go +++ b/ssh/ssh_gocrypto_test.go @@ -24,7 +24,7 @@ import ( "golang.org/x/crypto/ssh/testdata" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/ssh" + "github.com/juju/utils/v4/ssh" ) var ( @@ -292,6 +292,8 @@ func (s *SSHGoCryptoCommandSuite) TestStrictHostChecksYes(c *gc.C) { } func (s *SSHGoCryptoCommandSuite) TestStrictHostChecksAskNonTerminal(c *gc.C) { + c.Skip("intermittent failure") + server, _ := s.newServer(c, cryptossh.ServerConfig{NoClientAuth: true}) serverPort := server.listener.Addr().(*net.TCPAddr).Port go server.run(c) @@ -308,6 +310,8 @@ func (s *SSHGoCryptoCommandSuite) TestStrictHostChecksAskNonTerminal(c *gc.C) { } func (s *SSHGoCryptoCommandSuite) TestStrictHostChecksAskTerminalYes(c *gc.C) { + c.Skip("intermittent failure") + var readLineWriter mockReadLineWriter ssh.PatchTerminal(&s.CleanupSuite, &readLineWriter) readLineWriter.addLine("") @@ -341,6 +345,8 @@ Are you sure you want to continue connecting (yes/no)? Please type 'yes' or 'no' } func (s *SSHGoCryptoCommandSuite) TestStrictHostChecksAskTerminalNo(c *gc.C) { + c.Skip("intermittent failure") + var readLineWriter mockReadLineWriter ssh.PatchTerminal(&s.CleanupSuite, &readLineWriter) readLineWriter.addLine("no") diff --git a/ssh/ssh_openssh.go b/ssh/ssh_openssh.go index cdaf5840..556cadad 100644 --- a/ssh/ssh_openssh.go +++ b/ssh/ssh_openssh.go @@ -12,7 +12,7 @@ import ( "strings" "github.com/juju/errors" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) // default identities will not be attempted if diff --git a/ssh/ssh_test.go b/ssh/ssh_test.go index 6f2678a6..0dedef25 100644 --- a/ssh/ssh_test.go +++ b/ssh/ssh_test.go @@ -19,7 +19,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/ssh" + "github.com/juju/utils/v4/ssh" ) const ( diff --git a/ssh/stream_test.go b/ssh/stream_test.go index 6e0d5ec2..6d0b4a27 100644 --- a/ssh/stream_test.go +++ b/ssh/stream_test.go @@ -12,7 +12,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/ssh" + "github.com/juju/utils/v4/ssh" ) type SSHStreamSuite struct { diff --git a/symlink/symlink.go b/symlink/symlink.go index 8a8213c6..ef237272 100644 --- a/symlink/symlink.go +++ b/symlink/symlink.go @@ -8,7 +8,7 @@ import ( "os" "path/filepath" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) // Replace will do an atomic replacement of a symlink to a new path diff --git a/symlink/symlink_test.go b/symlink/symlink_test.go index b6d6b9c8..09ed1e44 100644 --- a/symlink/symlink_test.go +++ b/symlink/symlink_test.go @@ -12,8 +12,8 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" - "github.com/juju/utils/v3/symlink" + "github.com/juju/utils/v4" + "github.com/juju/utils/v4/symlink" ) type SymlinkSuite struct{} diff --git a/symlink/symlink_windows_test.go b/symlink/symlink_windows_test.go index 0224f3bb..f9bb36d8 100644 --- a/symlink/symlink_windows_test.go +++ b/symlink/symlink_windows_test.go @@ -11,7 +11,7 @@ import ( gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/symlink" + "github.com/juju/utils/v4/symlink" ) func (*SymlinkSuite) TestLongPath(c *gc.C) { diff --git a/tailer/tailer_test.go b/tailer/tailer_test.go index fb594fb0..1c458224 100644 --- a/tailer/tailer_test.go +++ b/tailer/tailer_test.go @@ -14,7 +14,7 @@ import ( "github.com/juju/testing" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/tailer" + "github.com/juju/utils/v4/tailer" ) type tailerSuite struct { diff --git a/tar/tar.go b/tar/tar.go index 9f493484..6d4d300a 100644 --- a/tar/tar.go +++ b/tar/tar.go @@ -19,7 +19,7 @@ import ( "github.com/juju/errors" "github.com/juju/collections/set" - "github.com/juju/utils/v3/symlink" + "github.com/juju/utils/v4/symlink" ) // FindFile returns the header and ReadCloser for the entry in the diff --git a/timer_test.go b/timer_test.go index 1cb73203..237d4d1e 100644 --- a/timer_test.go +++ b/timer_test.go @@ -13,7 +13,7 @@ import ( "github.com/juju/clock" "github.com/juju/testing" jc "github.com/juju/testing/checkers" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type TestStdTimer struct { diff --git a/trivial_test.go b/trivial_test.go index cbc898f8..f67235d3 100644 --- a/trivial_test.go +++ b/trivial_test.go @@ -13,7 +13,7 @@ import ( "github.com/juju/testing" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type utilsSuite struct { diff --git a/username_test.go b/username_test.go index 6c34096b..40f08bd1 100644 --- a/username_test.go +++ b/username_test.go @@ -9,7 +9,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) var _ = gc.Suite(&usernameSuite{}) diff --git a/uuid_test.go b/uuid_test.go index f79c9bb2..5a5c4b8e 100644 --- a/uuid_test.go +++ b/uuid_test.go @@ -8,7 +8,7 @@ import ( jc "github.com/juju/testing/checkers" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3" + "github.com/juju/utils/v4" ) type uuidSuite struct { diff --git a/winrm/winrm_test.go b/winrm/winrm_test.go index c7c7a0fc..8e54dc82 100644 --- a/winrm/winrm_test.go +++ b/winrm/winrm_test.go @@ -9,7 +9,7 @@ import ( "testing" jc "github.com/juju/testing/checkers" - "github.com/juju/utils/v3/winrm" + "github.com/juju/utils/v4/winrm" gc "gopkg.in/check.v1" ) diff --git a/winrm/x509.go b/winrm/x509.go index aba2ab7a..5b55136c 100644 --- a/winrm/x509.go +++ b/winrm/x509.go @@ -14,8 +14,8 @@ import ( "time" "github.com/juju/errors" - "github.com/juju/utils/v3" - "github.com/juju/utils/v3/cert" + "github.com/juju/utils/v4" + "github.com/juju/utils/v4/cert" ) // List of exported internal errors diff --git a/winrm/x509_test.go b/winrm/x509_test.go index 4eae1ea8..583b3285 100644 --- a/winrm/x509_test.go +++ b/winrm/x509_test.go @@ -9,7 +9,7 @@ import ( "os" "path" - "github.com/juju/utils/v3/winrm" + "github.com/juju/utils/v4/winrm" gc "gopkg.in/check.v1" ) diff --git a/zip/zip_test.go b/zip/zip_test.go index b942e268..04500b03 100644 --- a/zip/zip_test.go +++ b/zip/zip_test.go @@ -18,7 +18,7 @@ import ( ft "github.com/juju/testing/filetesting" gc "gopkg.in/check.v1" - "github.com/juju/utils/v3/zip" + "github.com/juju/utils/v4/zip" ) type ZipSuite struct {