Skip to content

Commit

Permalink
Merge pull request #89 from kolyshkin/go116-min
Browse files Browse the repository at this point in the history
Drop go < 1.16 compatibility
  • Loading branch information
thaJeztah committed Oct 28, 2021
2 parents 724ac41 + fb8a7cb commit 1bcc0b1
Show file tree
Hide file tree
Showing 28 changed files with 54 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.15.x, 1.16.x, 1.17.x]
go-version: [1.16.x, 1.17.x]
platform: [ubuntu-20.04, windows-latest, macos-11]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
1 change: 1 addition & 0 deletions mount/flags_bsd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build freebsd || openbsd
// +build freebsd openbsd

package mount
Expand Down
1 change: 1 addition & 0 deletions mount/flags_unix.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !darwin && !windows
// +build !darwin,!windows

package mount
Expand Down
4 changes: 2 additions & 2 deletions mount/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/moby/sys/mount

go 1.14
go 1.16

require (
github.com/moby/sys/mountinfo v0.4.1
golang.org/x/sys v0.0.0-20200922070232-aee5d888a860
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359
)
4 changes: 2 additions & 2 deletions mount/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/moby/sys/mountinfo v0.4.1 h1:1O+1cHA1aujwEwwVMa2Xm2l+gIpUHyd3+D+d7LZh1kM=
github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200922070232-aee5d888a860 h1:YEu4SMq7D0cmT7CBbXfcH0NZeuChAXwsHe/9XueUO6o=
golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6DgObAVZV+Fsp050NqXik=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1 change: 1 addition & 0 deletions mount/mount_errors.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

package mount
Expand Down
1 change: 1 addition & 0 deletions mount/mount_unix.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !darwin && !windows
// +build !darwin,!windows

package mount
Expand Down
1 change: 1 addition & 0 deletions mount/mount_unix_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !darwin && !windows
// +build !darwin,!windows

package mount
Expand Down
1 change: 1 addition & 0 deletions mount/mounter_freebsd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build freebsd && cgo
// +build freebsd,cgo

package mount
Expand Down
1 change: 1 addition & 0 deletions mount/mounter_openbsd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build openbsd && cgo
// +build openbsd,cgo

/*
Expand Down
1 change: 1 addition & 0 deletions mount/mounter_unsupported.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build (!linux && !freebsd && !openbsd && !windows) || (freebsd && !cgo) || (openbsd && !cgo)
// +build !linux,!freebsd,!openbsd,!windows freebsd,!cgo openbsd,!cgo

package mount
Expand Down
4 changes: 2 additions & 2 deletions mountinfo/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/moby/sys/mountinfo

go 1.14
go 1.16

require golang.org/x/sys v0.0.0-20200909081042-eff7692f9009
require golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359
4 changes: 2 additions & 2 deletions mountinfo/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009 h1:W0lCpv29Hv0UaM1LXb9QlBHLNP8UFfcKjblhVCWftOM=
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6DgObAVZV+Fsp050NqXik=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1 change: 1 addition & 0 deletions mountinfo/mounted_unix.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || (freebsd && cgo) || (openbsd && cgo) || (darwin && cgo)
// +build linux freebsd,cgo openbsd,cgo darwin,cgo

package mountinfo
Expand Down
1 change: 1 addition & 0 deletions mountinfo/mountinfo_bsd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build (freebsd && cgo) || (openbsd && cgo) || (darwin && cgo)
// +build freebsd,cgo openbsd,cgo darwin,cgo

package mountinfo
Expand Down
1 change: 1 addition & 0 deletions mountinfo/mountinfo_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

package mountinfo
Expand Down
1 change: 1 addition & 0 deletions mountinfo/mountinfo_unsupported.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build (!windows && !linux && !freebsd && !openbsd && !darwin) || (freebsd && !cgo) || (openbsd && !cgo) || (darwin && !cgo)
// +build !windows,!linux,!freebsd,!openbsd,!darwin freebsd,!cgo openbsd,!cgo darwin,!cgo

package mountinfo
Expand Down
4 changes: 2 additions & 2 deletions signal/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/moby/sys/signal

go 1.13
go 1.16

require golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
require golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359
4 changes: 2 additions & 2 deletions signal/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6DgObAVZV+Fsp050NqXik=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1 change: 1 addition & 0 deletions signal/signal_linux.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !mips && !mipsle && !mips64 && !mips64le
// +build !mips,!mipsle,!mips64,!mips64le

package signal
Expand Down
1 change: 1 addition & 0 deletions signal/signal_linux_mipsx.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux && (mips || mipsle || mips64 || mips64le)
// +build linux
// +build mips mipsle mips64 mips64le

Expand Down
1 change: 1 addition & 0 deletions signal/signal_linux_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build darwin || linux
// +build darwin linux

package signal
Expand Down
1 change: 1 addition & 0 deletions signal/signal_unix.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

package signal
Expand Down
1 change: 1 addition & 0 deletions signal/signal_unsupported.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !linux && !darwin && !freebsd && !windows
// +build !linux,!darwin,!freebsd,!windows

package signal
Expand Down
1 change: 1 addition & 0 deletions symlink/fs_unix.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

package symlink
Expand Down
50 changes: 19 additions & 31 deletions symlink/fs_unix_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

// Licensed under the Apache License, Version 2.0; See LICENSE.APACHE
Expand All @@ -6,7 +7,6 @@ package symlink

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -53,7 +53,7 @@ func testSymlink(tmpdir, path, expected, scope string) error {
}

func TestFollowSymlinkAbsolute(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

if err := makeFs(tmpdir, []dirOrLink{{path: "testdata/fs/a/d", target: "/b"}}); err != nil {
t.Fatal(err)
Expand All @@ -64,7 +64,7 @@ func TestFollowSymlinkAbsolute(t *testing.T) {
}

func TestFollowSymlinkRelativePath(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

if err := makeFs(tmpdir, []dirOrLink{{path: "testdata/fs/i", target: "a"}}); err != nil {
t.Fatal(err)
Expand All @@ -75,7 +75,7 @@ func TestFollowSymlinkRelativePath(t *testing.T) {
}

func TestFollowSymlinkSkipSymlinksOutsideScope(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

if err := makeFs(tmpdir, []dirOrLink{
{path: "linkdir", target: "realdir"},
Expand All @@ -95,7 +95,7 @@ func TestFollowSymlinkInvalidScopePathPair(t *testing.T) {
}

func TestFollowSymlinkLastLink(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

if err := makeFs(tmpdir, []dirOrLink{{path: "testdata/fs/a/d", target: "/b"}}); err != nil {
t.Fatal(err)
Expand All @@ -106,7 +106,7 @@ func TestFollowSymlinkLastLink(t *testing.T) {
}

func TestFollowSymlinkRelativeLinkChangeScope(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

if err := makeFs(tmpdir, []dirOrLink{{path: "testdata/fs/a/e", target: "../b"}}); err != nil {
t.Fatal(err)
Expand All @@ -122,7 +122,7 @@ func TestFollowSymlinkRelativeLinkChangeScope(t *testing.T) {
}

func TestFollowSymlinkDeepRelativeLinkChangeScope(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

if err := makeFs(tmpdir, []dirOrLink{{path: "testdata/fs/a/f", target: "../../../../test"}}); err != nil {
t.Fatal(err)
Expand All @@ -142,7 +142,7 @@ func TestFollowSymlinkDeepRelativeLinkChangeScope(t *testing.T) {
}

func TestFollowSymlinkRelativeLinkChain(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

// avoid letting symlink g (pointed at by symlink h) take out of scope
// TODO: we should probably normalize to scope here because ../[....]/root
Expand All @@ -159,7 +159,7 @@ func TestFollowSymlinkRelativeLinkChain(t *testing.T) {
}

func TestFollowSymlinkBreakoutPath(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

// avoid letting symlink -> ../directory/file escape from scope
// normalize to "testdata/fs/j"
Expand All @@ -172,7 +172,7 @@ func TestFollowSymlinkBreakoutPath(t *testing.T) {
}

func TestFollowSymlinkToRoot(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

// make sure we don't allow escaping to /
// normalize to dir
Expand All @@ -185,7 +185,7 @@ func TestFollowSymlinkToRoot(t *testing.T) {
}

func TestFollowSymlinkSlashDotdot(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()
tmpdir = filepath.Join(tmpdir, "dir", "subdir")

// make sure we don't allow escaping to /
Expand All @@ -199,7 +199,7 @@ func TestFollowSymlinkSlashDotdot(t *testing.T) {
}

func TestFollowSymlinkDotdot(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()
tmpdir = filepath.Join(tmpdir, "dir", "subdir")

// make sure we stay in scope without leaking information
Expand All @@ -214,7 +214,7 @@ func TestFollowSymlinkDotdot(t *testing.T) {
}

func TestFollowSymlinkRelativePath2(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

if err := makeFs(tmpdir, []dirOrLink{{path: "bar/foo", target: "baz/target"}}); err != nil {
t.Fatal(err)
Expand All @@ -225,7 +225,7 @@ func TestFollowSymlinkRelativePath2(t *testing.T) {
}

func TestFollowSymlinkScopeLink(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

if err := makeFs(tmpdir, []dirOrLink{
{path: "root2"},
Expand All @@ -240,7 +240,7 @@ func TestFollowSymlinkScopeLink(t *testing.T) {
}

func TestFollowSymlinkRootScope(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

expected, err := filepath.EvalSymlinks(tmpdir)
if err != nil {
Expand Down Expand Up @@ -270,7 +270,7 @@ func TestFollowSymlinkEmpty(t *testing.T) {
}

func TestFollowSymlinkCircular(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

if err := makeFs(tmpdir, []dirOrLink{{path: "root/foo", target: "foo"}}); err != nil {
t.Fatal(err)
Expand All @@ -292,7 +292,7 @@ func TestFollowSymlinkCircular(t *testing.T) {
}

func TestFollowSymlinkComplexChainWithTargetPathsContainingLinks(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

if err := makeFs(tmpdir, []dirOrLink{
{path: "root2"},
Expand All @@ -312,7 +312,7 @@ func TestFollowSymlinkComplexChainWithTargetPathsContainingLinks(t *testing.T) {
}

func TestFollowSymlinkBreakoutNonExistent(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

if err := makeFs(tmpdir, []dirOrLink{
{path: "root/slash", target: "/"},
Expand All @@ -326,7 +326,7 @@ func TestFollowSymlinkBreakoutNonExistent(t *testing.T) {
}

func TestFollowSymlinkNoLexicalCleaning(t *testing.T) {
tmpdir := mkTempDir(t)
tmpdir := t.TempDir()

if err := makeFs(tmpdir, []dirOrLink{
{path: "root/sym", target: "/foo/bar"},
Expand All @@ -338,15 +338,3 @@ func TestFollowSymlinkNoLexicalCleaning(t *testing.T) {
t.Fatal(err)
}
}

// TODO use testing.TempDir() instead (https://golang.org/pkg/testing/#T.TempDir)
// once we no longer test on Go 1.14 and older.
func mkTempDir(t *testing.T) string {
t.Helper()
tmpdir, err := ioutil.TempDir("", t.Name())
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = os.RemoveAll(tmpdir) })
return tmpdir
}
4 changes: 2 additions & 2 deletions symlink/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/moby/sys/symlink

go 1.14
go 1.16

require golang.org/x/sys v0.0.0-20200922070232-aee5d888a860
require golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359
4 changes: 2 additions & 2 deletions symlink/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang.org/x/sys v0.0.0-20200922070232-aee5d888a860 h1:YEu4SMq7D0cmT7CBbXfcH0NZeuChAXwsHe/9XueUO6o=
golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6DgObAVZV+Fsp050NqXik=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

0 comments on commit 1bcc0b1

Please sign in to comment.