Skip to content

Commit

Permalink
Revert "upgrade to go 1.16"
Browse files Browse the repository at this point in the history
This reverts commit 05ee490.
  • Loading branch information
dundee committed Feb 23, 2021
1 parent 3422c17 commit ad22369
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
14 changes: 7 additions & 7 deletions analyze/dir.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package analyze

import (
"io/ioutil"
"log"
"os"
"path/filepath"
Expand Down Expand Up @@ -84,10 +85,9 @@ func (a *ParallelAnalyzer) processDir(path string) *File {
err error
mutex sync.Mutex
totalSize int64
info os.FileInfo
)

files, err := os.ReadDir(path)
files, err := ioutil.ReadDir(path)
if err != nil {
log.Print(err.Error())
}
Expand Down Expand Up @@ -121,17 +121,17 @@ func (a *ParallelAnalyzer) processDir(path string) *File {
a.wait.Done()
}()
} else {
info, _ = f.Info()
file = &File{
Name: f.Name(),
Flag: getFlag(info),
Size: info.Size(),
Flag: getFlag(f),
Size: f.Size(),
ItemCount: 1,
Parent: &dir,
}
setPlatformSpecificAttrs(file, info)

totalSize += info.Size()
setPlatformSpecificAttrs(file, f)

totalSize += f.Size()

mutex.Lock()
dir.Files = append(dir.Files, file)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/dundee/gdu/v4

go 1.16
go 1.15

require (
github.com/fatih/color v1.10.0
Expand Down
5 changes: 3 additions & 2 deletions internal/testdir/test_dir.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package testdir

import (
"io/ioutil"
"os"
)

// CreateTestDir creates test dir structure
func CreateTestDir() func() {
os.MkdirAll("test_dir/nested/subnested", os.ModePerm)
os.WriteFile("test_dir/nested/subnested/file", []byte("hello"), 0644)
os.WriteFile("test_dir/nested/file2", []byte("go"), 0644)
ioutil.WriteFile("test_dir/nested/subnested/file", []byte("hello"), 0644)
ioutil.WriteFile("test_dir/nested/file2", []byte("go"), 0644)
return func() {
err := os.RemoveAll("test_dir")
if err != nil {
Expand Down

0 comments on commit ad22369

Please sign in to comment.