Skip to content

Commit

Permalink
Merge pull request #135 from alexandear/remove-unused-go-1.15-files
Browse files Browse the repository at this point in the history
Remove unnecessary files used for Go 1.15
  • Loading branch information
otiai10 committed Jan 9, 2024
2 parents 83d4daf + 03621bf commit 2e7e0e6
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 83 deletions.
17 changes: 0 additions & 17 deletions fileinfo_go1.15.go

This file was deleted.

17 changes: 0 additions & 17 deletions fileinfo_go1.16.go

This file was deleted.

41 changes: 0 additions & 41 deletions patherror_go1.15_test.go

This file was deleted.

3 changes: 0 additions & 3 deletions patherror_go1.16_test.go → patherror_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build go1.16
// +build go1.16

package copy

import (
Expand Down
7 changes: 4 additions & 3 deletions permission_control.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package copy

import (
"io/fs"
"os"
)

Expand All @@ -11,11 +12,11 @@ const (
tmpPermissionForDirectory = os.FileMode(0755)
)

type PermissionControlFunc func(srcinfo fileInfo, dest string) (chmodfunc func(*error), err error)
type PermissionControlFunc func(srcinfo fs.FileInfo, dest string) (chmodfunc func(*error), err error)

var (
AddPermission = func(perm os.FileMode) PermissionControlFunc {
return func(srcinfo fileInfo, dest string) (func(*error), error) {
return func(srcinfo fs.FileInfo, dest string) (func(*error), error) {
orig := srcinfo.Mode()
if srcinfo.IsDir() {
if err := os.MkdirAll(dest, tmpPermissionForDirectory); err != nil {
Expand All @@ -28,7 +29,7 @@ var (
}
}
PerservePermission PermissionControlFunc = AddPermission(0)
DoNothing PermissionControlFunc = func(srcinfo fileInfo, dest string) (func(*error), error) {
DoNothing PermissionControlFunc = func(srcinfo fs.FileInfo, dest string) (func(*error), error) {
if srcinfo.IsDir() {
if err := os.MkdirAll(dest, srcinfo.Mode()); err != nil {
return func(*error) {}, err
Expand Down
3 changes: 2 additions & 1 deletion preserve_owner.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
package copy

import (
"io/fs"
"os"
"syscall"
)

func preserveOwner(src, dest string, info fileInfo) (err error) {
func preserveOwner(src, dest string, info fs.FileInfo) (err error) {
if info == nil {
if info, err = os.Stat(src); err != nil {
return err
Expand Down
4 changes: 3 additions & 1 deletion preserve_owner_x.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

package copy

func preserveOwner(src, dest string, info fileInfo) (err error) {
import "io/fs"

func preserveOwner(src, dest string, info fs.FileInfo) (err error) {
return nil
}

0 comments on commit 2e7e0e6

Please sign in to comment.