Skip to content

Commit

Permalink
Move to golang 1.18 and later
Browse files Browse the repository at this point in the history
Github.com is reporting security issues on older versions of
golang.

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Feb 27, 2023
1 parent 2988d7e commit 5851305
Show file tree
Hide file tree
Showing 208 changed files with 372 additions and 172 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ help: ## this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-z A-Z_-]+:.*?## / {gsub(" ",",",$$1);gsub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-21s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

vendor-in-container:
podman run --privileged --rm --env HOME=/root -v `pwd`:/src -w /src golang:1.17 make vendor
podman run --privileged --rm --env HOME=/root -v `pwd`:/src -w /src golang make vendor

vendor:
$(GO) mod tidy -compat=1.17
$(GO) mod tidy
$(GO) mod vendor
$(GO) mod verify
2 changes: 1 addition & 1 deletion drivers/driver_solaris.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (c *defaultChecker) IsMounted(path string) bool {
}

// Mounted checks if the given path is mounted as the fs type
//Solaris supports only ZFS for now
// Solaris supports only ZFS for now
func Mounted(fsType FsMagic, mountPath string) (bool, error) {

cs := C.CString(filepath.Dir(mountPath))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.17
go 1.18

module github.com/containers/storage

Expand Down
3 changes: 2 additions & 1 deletion pkg/archive/archive_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import (
// ├── d2 # opaque, 0750
// │   └── f1 # empty file, 0660
// └── d3 # 0700
// └── f1 # whiteout, 0000
//
// └── f1 # whiteout, 0000
func setupOverlayTestDir(t *testing.T, src string) {
// Create opaque directory containing single file and permission 0700
err := os.Mkdir(filepath.Join(src, "d1"), 0700)
Expand Down
98 changes: 57 additions & 41 deletions pkg/archive/copy_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,9 @@ func TestCopyErrDstNotDir(t *testing.T) {
//

// A. SRC specifies a file and DST (no trailing path separator) doesn't
// exist. This should create a file with the name DST and copy the
// contents of the source file into it.
//
// exist. This should create a file with the name DST and copy the
// contents of the source file into it.
func TestCopyCaseA(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -297,8 +298,9 @@ func TestCopyCaseA(t *testing.T) {
}

// B. SRC specifies a file and DST (with trailing path separator) doesn't
// exist. This should cause an error because the copy operation cannot
// create a directory when copying a single file.
//
// exist. This should cause an error because the copy operation cannot
// create a directory when copying a single file.
func TestCopyCaseB(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -330,7 +332,8 @@ func TestCopyCaseB(t *testing.T) {
}

// C. SRC specifies a file and DST exists as a file. This should overwrite
// the file at DST with the contents of the source file.
//
// the file at DST with the contents of the source file.
func TestCopyCaseC(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand All @@ -357,8 +360,9 @@ func TestCopyCaseC(t *testing.T) {
}

// C. Symbol link following version:
// SRC specifies a file and DST exists as a file. This should overwrite
// the file at DST with the contents of the source file.
//
// SRC specifies a file and DST exists as a file. This should overwrite
// the file at DST with the contents of the source file.
func TestCopyCaseCFSym(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -393,8 +397,9 @@ func TestCopyCaseCFSym(t *testing.T) {
}

// D. SRC specifies a file and DST exists as a directory. This should place
// a copy of the source file inside it using the basename from SRC. Ensure
// this works whether DST has a trailing path separator or not.
//
// a copy of the source file inside it using the basename from SRC. Ensure
// this works whether DST has a trailing path separator or not.
func TestCopyCaseD(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -441,9 +446,10 @@ func TestCopyCaseD(t *testing.T) {
}

// D. Symbol link following version:
// SRC specifies a file and DST exists as a directory. This should place
// a copy of the source file inside it using the basename from SRC. Ensure
// this works whether DST has a trailing path separator or not.
//
// SRC specifies a file and DST exists as a directory. This should place
// a copy of the source file inside it using the basename from SRC. Ensure
// this works whether DST has a trailing path separator or not.
func TestCopyCaseDFSym(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -491,9 +497,10 @@ func TestCopyCaseDFSym(t *testing.T) {
}

// E. SRC specifies a directory and DST does not exist. This should create a
// directory at DST and copy the contents of the SRC directory into the DST
// directory. Ensure this works whether DST has a trailing path separator or
// not.
//
// directory at DST and copy the contents of the SRC directory into the DST
// directory. Ensure this works whether DST has a trailing path separator or
// not.
func TestCopyCaseE(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -533,10 +540,11 @@ func TestCopyCaseE(t *testing.T) {
}

// E. Symbol link following version:
// SRC specifies a directory and DST does not exist. This should create a
// directory at DST and copy the contents of the SRC directory into the DST
// directory. Ensure this works whether DST has a trailing path separator or
// not.
//
// SRC specifies a directory and DST does not exist. This should create a
// directory at DST and copy the contents of the SRC directory into the DST
// directory. Ensure this works whether DST has a trailing path separator or
// not.
func TestCopyCaseEFSym(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -577,7 +585,8 @@ func TestCopyCaseEFSym(t *testing.T) {
}

// F. SRC specifies a directory and DST exists as a file. This should cause an
// error as it is not possible to overwrite a file with a directory.
//
// error as it is not possible to overwrite a file with a directory.
func TestCopyCaseF(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -610,8 +619,9 @@ func TestCopyCaseF(t *testing.T) {
}

// G. SRC specifies a directory and DST exists as a directory. This should copy
// the SRC directory and all its contents to the DST directory. Ensure this
// works whether DST has a trailing path separator or not.
//
// the SRC directory and all its contents to the DST directory. Ensure this
// works whether DST has a trailing path separator or not.
func TestCopyCaseG(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -653,9 +663,10 @@ func TestCopyCaseG(t *testing.T) {
}

// G. Symbol link version:
// SRC specifies a directory and DST exists as a directory. This should copy
// the SRC directory and all its contents to the DST directory. Ensure this
// works whether DST has a trailing path separator or not.
//
// SRC specifies a directory and DST exists as a directory. This should copy
// the SRC directory and all its contents to the DST directory. Ensure this
// works whether DST has a trailing path separator or not.
func TestCopyCaseGFSym(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -698,9 +709,10 @@ func TestCopyCaseGFSym(t *testing.T) {
}

// H. SRC specifies a directory's contents only and DST does not exist. This
// should create a directory at DST and copy the contents of the SRC
// directory (but not the directory itself) into the DST directory. Ensure
// this works whether DST has a trailing path separator or not.
//
// should create a directory at DST and copy the contents of the SRC
// directory (but not the directory itself) into the DST directory. Ensure
// this works whether DST has a trailing path separator or not.
func TestCopyCaseH(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -744,10 +756,11 @@ func TestCopyCaseH(t *testing.T) {
}

// H. Symbol link following version:
// SRC specifies a directory's contents only and DST does not exist. This
// should create a directory at DST and copy the contents of the SRC
// directory (but not the directory itself) into the DST directory. Ensure
// this works whether DST has a trailing path separator or not.
//
// SRC specifies a directory's contents only and DST does not exist. This
// should create a directory at DST and copy the contents of the SRC
// directory (but not the directory itself) into the DST directory. Ensure
// this works whether DST has a trailing path separator or not.
func TestCopyCaseHFSym(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -792,8 +805,9 @@ func TestCopyCaseHFSym(t *testing.T) {
}

// I. SRC specifies a directory's contents only and DST exists as a file. This
// should cause an error as it is not possible to overwrite a file with a
// directory.
//
// should cause an error as it is not possible to overwrite a file with a
// directory.
func TestCopyCaseI(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -826,9 +840,10 @@ func TestCopyCaseI(t *testing.T) {
}

// J. SRC specifies a directory's contents only and DST exists as a directory.
// This should copy the contents of the SRC directory (but not the directory
// itself) into the DST directory. Ensure this works whether DST has a
// trailing path separator or not.
//
// This should copy the contents of the SRC directory (but not the directory
// itself) into the DST directory. Ensure this works whether DST has a
// trailing path separator or not.
func TestCopyCaseJ(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down Expand Up @@ -874,10 +889,11 @@ func TestCopyCaseJ(t *testing.T) {
}

// J. Symbol link following version:
// SRC specifies a directory's contents only and DST exists as a directory.
// This should copy the contents of the SRC directory (but not the directory
// itself) into the DST directory. Ensure this works whether DST has a
// trailing path separator or not.
//
// SRC specifies a directory's contents only and DST exists as a directory.
// This should copy the contents of the SRC directory (but not the directory
// itself) into the DST directory. Ensure this works whether DST has a
// trailing path separator or not.
func TestCopyCaseJFSym(t *testing.T) {
tmpDirA, tmpDirB := getTestTempDirs(t)

Expand Down
4 changes: 2 additions & 2 deletions pkg/archive/wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
// Generate("foo.txt", "hello world", "emptyfile")
//
// The above call will return an archive with 2 files:
// * ./foo.txt with content "hello world"
// * ./empty with empty content
// - ./foo.txt with content "hello world"
// - ./empty with empty content
//
// FIXME: stream content instead of buffering
// FIXME: specify permissions and other archive metadata
Expand Down
1 change: 1 addition & 0 deletions pkg/devicemapper/devmapper_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func LogInit(logger DevmapperLogger) {
// because we are using callbacks, this function will be called for *every* log
// in libdm (even debug ones because there's no way of setting the verbosity
// level for an external logging callback).
//
//export StorageDevmapperLogCallback
func StorageDevmapperLogCallback(level C.int, file *C.char, line, dmErrnoOrClass C.int, message *C.char) {
msg := C.GoString(message)
Expand Down
15 changes: 8 additions & 7 deletions pkg/parsers/parsers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ func ParseKeyValueOpt(opt string) (string, string, error) {
// input string. It returns a `map[int]bool` with available elements from `val`
// set to `true`.
// Supported formats:
// 7
// 1-6
// 0,3-4,7,8-10
// 0-0,0,1-7
// 03,1-3 <- this is gonna get parsed as [1,2,3]
// 3,2,1
// 0-2,3,1
//
// 7
// 1-6
// 0,3-4,7,8-10
// 0-0,0,1-7
// 03,1-3 <- this is gonna get parsed as [1,2,3]
// 3,2,1
// 0-2,3,1
func ParseUintList(val string) (map[int]bool, error) {
if val == "" {
return map[int]bool{}, nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/system/chtimes_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"time"
)

//setCTime will set the create time on a file. On Unix, the create
//time is updated as a side effect of setting the modified time, so
//no action is required.
// setCTime will set the create time on a file. On Unix, the create
// time is updated as a side effect of setting the modified time, so
// no action is required.
func setCTime(path string, ctime time.Time) error {
return nil
}
4 changes: 2 additions & 2 deletions pkg/system/chtimes_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"golang.org/x/sys/windows"
)

//setCTime will set the create time on a file. On Windows, this requires
//calling SetFileTime and explicitly including the create time.
// setCTime will set the create time on a file. On Windows, this requires
// calling SetFileTime and explicitly including the create time.
func setCTime(path string, ctime time.Time) error {
ctimespec := windows.NsecToTimespec(ctime.UnixNano())
pathp, e := windows.UTF16PtrFromString(path)
Expand Down
3 changes: 2 additions & 1 deletion pkg/system/meminfo_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ func getSwapInfo() (int64, int64, error) {
}

// ReadMemInfo retrieves memory statistics of the host system and returns a
// MemInfo type.
//
// MemInfo type.
func ReadMemInfo() (*MemInfo, error) {
MemTotal, MemFree, err := getMemInfo()
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/system/meminfo_solaris.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ func getFreeMem() int64 {
}

// ReadMemInfo retrieves memory statistics of the host system and returns a
// MemInfo type.
//
// MemInfo type.
func ReadMemInfo() (*MemInfo, error) {

ppKernel := C.getPpKernel()
Expand Down
3 changes: 2 additions & 1 deletion pkg/system/meminfo_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ type memorystatusex struct {
}

// ReadMemInfo retrieves memory statistics of the host system and returns a
// MemInfo type.
//
// MemInfo type.
func ReadMemInfo() (*MemInfo, error) {
msi := &memorystatusex{
dwLength: 64,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions tests/tools/vendor/github.com/sirupsen/logrus/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5851305

Please sign in to comment.