aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/atomicrename/main.go7
-rw-r--r--contrib/findholes/holes/holes.go4
2 files changed, 4 insertions, 7 deletions
diff --git a/contrib/atomicrename/main.go b/contrib/atomicrename/main.go
index 394753b..337371c 100644
--- a/contrib/atomicrename/main.go
+++ b/contrib/atomicrename/main.go
@@ -4,7 +4,6 @@ import (
"bytes"
"flag"
"fmt"
- "io/ioutil"
"os"
"strings"
"sync/atomic"
@@ -49,7 +48,7 @@ func main() {
srcFiles[srcName] = struct{}{}
buf := bytes.Repeat([]byte("_"), i)
buf = append(buf, hello...)
- if err := ioutil.WriteFile(srcName, buf, 0600); err != nil {
+ if err := os.WriteFile(srcName, buf, 0600); err != nil {
panic(err)
}
fmt.Print(".")
@@ -58,7 +57,7 @@ func main() {
// prepare destination file
const dstName = "dst.atomicrename"
- if err := ioutil.WriteFile(dstName, hello, 0600); err != nil {
+ if err := os.WriteFile(dstName, hello, 0600); err != nil {
panic(err)
}
@@ -69,7 +68,7 @@ func main() {
// read thread
go func() {
for atomic.LoadInt32(&running) == 1 {
- have, err := ioutil.ReadFile(dstName)
+ have, err := os.ReadFile(dstName)
if err != nil {
fmt.Println(err)
stats.readError++
diff --git a/contrib/findholes/holes/holes.go b/contrib/findholes/holes/holes.go
index 95c9d2b..72f5114 100644
--- a/contrib/findholes/holes/holes.go
+++ b/contrib/findholes/holes/holes.go
@@ -8,7 +8,6 @@ import (
"math/rand"
"os"
"syscall"
- "time"
)
const (
@@ -130,7 +129,7 @@ func Find(fd int) (segments []Segment, err error) {
cursor = off
if oldCursor == cursor {
- return nil, fmt.Errorf("%s\nerror: seek loop!", PrettyPrint(segments))
+ return nil, fmt.Errorf("%s\nerror: seek loop", PrettyPrint(segments))
}
}
return segments, nil
@@ -176,7 +175,6 @@ func Create(path string) {
}
defer f.Close()
- rand.Seed(time.Now().UnixNano())
offsets := make([]int64, 10)
for i := range offsets {
offsets[i] = int64(rand.Int31n(60000))