Skip to content

Commit

Permalink
Merge pull request #29 from bitnami/go-1.18.2
Browse files Browse the repository at this point in the history
Update go and deps versions
  • Loading branch information
marcosbc authored Nov 9, 2022
2 parents 0080879 + cd3be91 commit a547c5e
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 47 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
- master
- main

release:
types: [published]
Expand All @@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '^1.18.2' # The Go version to download (if necessary) and use.
go-version: '^1.18.8' # The Go version to download (if necessary) and use.
- name: Install Build Dependencies
run: make get-build-deps
- name: Download required modules
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ go 1.18
require (
github.com/VividCortex/godaemon v1.0.0
github.com/julienschmidt/httprouter v1.3.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.2.1
github.com/stretchr/testify v1.7.0
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.6.1
github.com/stretchr/testify v1.8.1
golang.org/x/sys v0.2.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
20 changes: 20 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnht
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -163,6 +164,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
Expand Down Expand Up @@ -203,29 +206,40 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw=
github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk=
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down Expand Up @@ -390,6 +404,9 @@ golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/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=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -558,6 +575,7 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand All @@ -570,6 +588,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
3 changes: 1 addition & 2 deletions gonit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"flag"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -520,7 +519,7 @@ func (suite *CmdSuite) TestReloadCommand() {
suite.NotRegexp("(?s).*Process mysql.*", r.stdout)

suite.NotRegexp("(?s).*Process sample_check.*", r.stdout)
ioutil.WriteFile(
os.WriteFile(
filepath.Join(rootDir, "conf/gonit/conf.d/mysql.conf"),
[]byte("check process sample_check"), os.FileMode(0644))

Expand Down
5 changes: 2 additions & 3 deletions gonittest/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"html/template"
"io"
"io/ioutil"
"os"
"path/filepath"
"reflect"
Expand Down Expand Up @@ -44,7 +43,7 @@ type tmplResolver struct {

func (r *tmplResolver) LoadFile(path string) error {
if r.Error == nil {
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
r.Data, r.Error = string(data), err
}
return r.Error
Expand All @@ -56,7 +55,7 @@ func (r *tmplResolver) Load(data string) {

func (r *tmplResolver) WriteToFile(path string) error {
if r.Error == nil {
r.Error = ioutil.WriteFile(path, []byte(r.Data), os.FileMode(0755))
r.Error = os.WriteFile(path, []byte(r.Data), os.FileMode(0755))
}
return r.Error
}
Expand Down
3 changes: 1 addition & 2 deletions log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package log
import (
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -48,7 +47,7 @@ func New() *logrus.Logger {

// DummyLogger provides a dummy logger object
func DummyLogger() *Logger {
return StreamLogger(ioutil.Discard)
return StreamLogger(io.Discard)
}

// StreamLogger returns a logger backed by a provided io.Writter
Expand Down
4 changes: 2 additions & 2 deletions monitor/parsing.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package monitor

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
Expand Down Expand Up @@ -80,7 +80,7 @@ func (cp *configParser) ParseConfigFile(f string, cw interface {
// TODO: Not sure if bug or feature, but monit only validates the first level
// config file. Included files permissions and ownership are not validated
// data, err := utils.ReadSecure(f)
bytes, err := ioutil.ReadFile(utils.AbsFile(f))
bytes, err := os.ReadFile(utils.AbsFile(f))
if err != nil {
return err
}
Expand Down
5 changes: 2 additions & 3 deletions testutils/sandbox.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package testutils

import (
"io/ioutil"
"log"
"math/rand"
"os"
Expand Down Expand Up @@ -33,7 +32,7 @@ func NewSandbox(args ...string) *Sandbox {
if len(args) > 0 {
root = args[0]
} else {
root, err = ioutil.TempDir("", "sandbox")
root, err = os.MkdirTemp("", "sandbox")
if err != nil {
log.Fatal("Error creating temporary directory for sandbox")
}
Expand Down Expand Up @@ -117,7 +116,7 @@ func (sb *Sandbox) Write(path string, data string) (string, error) {
func (sb *Sandbox) WriteFile(path string, data []byte, mode os.FileMode) (string, error) {
f := sb.Normalize(path)
sb.Track(f)
return f, ioutil.WriteFile(f, data, mode)
return f, os.WriteFile(f, data, mode)
}

// Cleanup removes all the resources created by the sandbox
Expand Down
31 changes: 15 additions & 16 deletions testutils/sandbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package testutils

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
Expand All @@ -14,7 +13,7 @@ import (
)

func TestNewSandbox(t *testing.T) {
root, err := ioutil.TempDir("", "sandbox")
root, err := os.MkdirTemp("", "sandbox")
require.NoError(t, err)

sb1 := NewSandbox(root)
Expand Down Expand Up @@ -45,7 +44,7 @@ func TestCleanup(t *testing.T) {
defer sb.Cleanup()

tmpFile := filepath.Join(sb.Root, "sample.txt")
err := ioutil.WriteFile(tmpFile, []byte{}, os.FileMode(0644))
err := os.WriteFile(tmpFile, []byte{}, os.FileMode(0644))
require.NoError(t, err)

assert.NoError(t, sb.Cleanup())
Expand All @@ -72,7 +71,7 @@ func TestCleanup(t *testing.T) {
}

func TestNormalize(t *testing.T) {
root, err := ioutil.TempDir("", "sandbox")
root, err := os.MkdirTemp("", "sandbox")
require.NoError(t, err)

sb := NewSandbox(root)
Expand All @@ -87,7 +86,7 @@ func TestNormalize(t *testing.T) {

func TestContainsPath(t *testing.T) {

root, err := ioutil.TempDir("", "sandbox")
root, err := os.MkdirTemp("", "sandbox")
require.NoError(t, err)

sb := NewSandbox(root)
Expand All @@ -111,7 +110,7 @@ func TestContainsPath(t *testing.T) {
}

func TestWriteFile(t *testing.T) {
root, err := ioutil.TempDir("", "sandbox")
root, err := os.MkdirTemp("", "sandbox")
require.NoError(t, err)

sb := NewSandbox(root)
Expand All @@ -122,15 +121,15 @@ func TestWriteFile(t *testing.T) {
f, err := sb.WriteFile(tail, []byte(data), os.FileMode(0644))
assert.NoError(t, err)
assert.Equal(t, filepath.Join(root, tail), f)
read, err := ioutil.ReadFile(f)
read, err := os.ReadFile(f)
assert.NoError(t, err)

assert.Equal(t, data, string(read))
}

func TestWrite(t *testing.T) {

root, err := ioutil.TempDir("", "sandbox")
root, err := os.MkdirTemp("", "sandbox")
require.NoError(t, err)

sb := NewSandbox(root)
Expand All @@ -141,14 +140,14 @@ func TestWrite(t *testing.T) {
f, err := sb.Write(tail, data)
assert.NoError(t, err)
assert.Equal(t, filepath.Join(root, tail), f)
read, err := ioutil.ReadFile(f)
read, err := os.ReadFile(f)
assert.NoError(t, err)

assert.Equal(t, data, string(read))
}

func TestSymlink(t *testing.T) {
root, err := ioutil.TempDir("", "sandbox")
root, err := os.MkdirTemp("", "sandbox")
require.NoError(t, err)

sb := NewSandbox(root)
Expand All @@ -162,7 +161,7 @@ func TestSymlink(t *testing.T) {
}

func TestMkdir(t *testing.T) {
root, err := ioutil.TempDir("", "sandbox")
root, err := os.MkdirTemp("", "sandbox")
require.NoError(t, err)

sb := NewSandbox(root)
Expand All @@ -180,7 +179,7 @@ func TestMkdir(t *testing.T) {
assert.True(t, s.IsDir(), "Expected %s to be a directory", fullPath)
}
func TestTouch(t *testing.T) {
root, err := ioutil.TempDir("", "sandbox")
root, err := os.MkdirTemp("", "sandbox")
require.NoError(t, err)

sb := NewSandbox(root)
Expand All @@ -205,7 +204,7 @@ func TestTouch(t *testing.T) {
}

func TestTempFile(t *testing.T) {
root, err := ioutil.TempDir("", "sandbox")
root, err := os.MkdirTemp("", "sandbox")
require.NoError(t, err)

sb := NewSandbox(root)
Expand All @@ -226,7 +225,7 @@ func TestTempFile(t *testing.T) {
// If the file to create exists, an additional numeric index is appended until
// the target file does not exists
currentIndex := tempFileIndex
ioutil.WriteFile(
os.WriteFile(
filepath.Join(root, fmt.Sprintf("%s%d", tail, currentIndex)),
[]byte{}, os.FileMode(0644),
)
Expand All @@ -235,12 +234,12 @@ func TestTempFile(t *testing.T) {
assert.Equal(t, fmt.Sprintf("%s/%s%d0", root, tail, currentIndex), f3)

currentIndex = tempFileIndex
ioutil.WriteFile(
os.WriteFile(
filepath.Join(root, fmt.Sprintf("%s%d", tail, currentIndex)),
[]byte{}, os.FileMode(0644),
)
for i := 0; i < 2; i++ {
ioutil.WriteFile(
os.WriteFile(
filepath.Join(root, fmt.Sprintf("%s%d%d", tail, currentIndex, i)),
[]byte{}, os.FileMode(0644),
)
Expand Down
Loading

0 comments on commit a547c5e

Please sign in to comment.