Skip to content

Commit

Permalink
Upgrade to Go 1.16 (#1803)
Browse files Browse the repository at this point in the history
Remove usage of io/ioutil: https://golang.org/doc/go1.16?s=03#ioutil

RELEASE_NOTES=[ENHANCEMENT] Use Go 1.16

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
  • Loading branch information
dominikschulz committed Feb 17, 2021
1 parent 537312a commit 73ed2c1
Show file tree
Hide file tree
Showing 51 changed files with 113 additions and 171 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/autorelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
go-version: 1.16
-
name: Import GPG signing key
id: import_gpg
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.x
go-version: 1.16

- name: Ubuntu Dependencies
run: sudo apt-get install --yes git gnupg2
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.x
go-version: 1.16

- run: git config --global user.name nobody
- run: git config --global user.email foo.bar@example.org
Expand All @@ -81,7 +81,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.x
go-version: 1.16

- name: MacOS Dependencies
run: brew install git gnupg
Expand Down
15 changes: 0 additions & 15 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
filippo.io/age v1.0.0-beta7 h1:RZiSK+N3KL2UwT82xiCavjYw8jJHzWMEUYePAukTpk0=
filippo.io/age v1.0.0-beta7/go.mod h1:chAuTrTb0FTTmKtvs6fQTGhYTvH9AigjN1uEUsvLdZ0=
filippo.io/edwards25519 v1.0.0-alpha.2 h1:EWbZLqGEPSIj2W69gx04KtNVkyPIfe3uj0DhDQJonbQ=
filippo.io/edwards25519 v1.0.0-alpha.2/go.mod h1:X+pm78QAUPtFLi1z9PYIlS/bdDnvbCOGKtZ+ACWEf7o=
filippo.io/edwards25519 v1.0.0-beta.3 h1:WQxB0FH5NzrhciInJ30bgL3soLng3AbdI651yQuVlCs=
filippo.io/edwards25519 v1.0.0-beta.3/go.mod h1:X+pm78QAUPtFLi1z9PYIlS/bdDnvbCOGKtZ+ACWEf7o=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY=
github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
Expand All @@ -20,7 +18,6 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5O
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
Expand All @@ -34,15 +31,13 @@ github.com/godbus/dbus v0.0.0-20190623212516-8a1682060722 h1:NNKZiuNXd6lpZRyoFM/
github.com/godbus/dbus v0.0.0-20190623212516-8a1682060722/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
github.com/gokyle/twofactor v1.0.1 h1:uRhvx0S4Hb82RPIDALnf7QxbmPL49LyyaCkJDpWx+Ek=
github.com/gokyle/twofactor v1.0.1/go.mod h1:4gxzH1eaE/F3Pct/sCDNOylP0ClofUO5j4XZN9tKtLE=
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
Expand All @@ -56,7 +51,6 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNU
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
Expand All @@ -81,15 +75,13 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/schollz/closestmatch v0.0.0-20190308193919-1fbe626be92e h1:HFUDYOpUVZ0oTXeZy2A59Lkf69SsOF03Lg1GsI3Xh9o=
github.com/schollz/closestmatch v0.0.0-20190308193919-1fbe626be92e/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
Expand All @@ -101,7 +93,6 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/xrash/smetrics v0.0.0-20170218160415-a3153f7040e9 h1:w8V9v0qVympSF6GjdjIyeqR7+EVhAF9CBQmkmW7Zw0w=
github.com/xrash/smetrics v0.0.0-20170218160415-a3153f7040e9/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
Expand All @@ -110,7 +101,6 @@ golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
Expand All @@ -124,25 +114,20 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210217090653-ed5674b6da4a h1:m4knbKtdWq+rPB3TE+ApaRzkETZngkKdhYjvTnnRq4s=
golang.org/x/sys v0.0.0-20210217090653-ed5674b6da4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M=
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190624222133-a101b041ded4 h1:1mMox4TgefDwqluYCv677yNXwlfTkija4owZve/jr78=
golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
5 changes: 2 additions & 3 deletions helpers/release/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"regexp"
Expand Down Expand Up @@ -274,7 +273,7 @@ func writeChangelog(prev, next semver.Version) error {
}

func writeVersion(v semver.Version) error {
return ioutil.WriteFile("VERSION", []byte(v.String()+"\n"), 0644)
return os.WriteFile("VERSION", []byte(v.String()+"\n"), 0644)
}

type tplPayload struct {
Expand Down Expand Up @@ -309,7 +308,7 @@ func isGitClean() bool {
}

func versionFile() (semver.Version, error) {
buf, err := ioutil.ReadFile("VERSION")
buf, err := os.ReadFile("VERSION")
if err != nil {
return semver.Version{}, err
}
Expand Down
5 changes: 2 additions & 3 deletions internal/action/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package action
import (
"context"
"flag"
"io/ioutil"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -66,7 +65,7 @@ func TestAction(t *testing.T) {
}

func TestNew(t *testing.T) {
td, err := ioutil.TempDir("", "gopass-")
td, err := os.MkdirTemp("", "gopass-")
require.NoError(t, err)
defer func() {
_ = os.RemoveAll(td)
Expand All @@ -83,7 +82,7 @@ func TestNew(t *testing.T) {
t.Run("init an existing plain store", func(t *testing.T) {
cfg.Path = filepath.Join(td, "store")
assert.NoError(t, os.MkdirAll(cfg.Path, 0700))
assert.NoError(t, ioutil.WriteFile(filepath.Join(cfg.Path, plain.IDFile), []byte("foobar"), 0600))
assert.NoError(t, os.WriteFile(filepath.Join(cfg.Path, plain.IDFile), []byte("foobar"), 0600))
_, err = New(cfg, sv)
assert.NoError(t, err)
})
Expand Down
5 changes: 2 additions & 3 deletions internal/action/binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"encoding/base64"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -157,7 +156,7 @@ func (s *Action) binaryCopyFromFileToStore(ctx context.Context, from, to string,
// and a relative one for the secret

// copy from FS to store
buf, err := ioutil.ReadFile(from)
buf, err := os.ReadFile(from)
if err != nil {
return fmt.Errorf("failed to read file from %q: %w", from, err)
}
Expand Down Expand Up @@ -191,7 +190,7 @@ func (s *Action) binaryCopyFromStoreToFile(ctx context.Context, from, to string,
if err != nil {
return fmt.Errorf("failed to read data from %q: %w", from, err)
}
if err := ioutil.WriteFile(to, buf, 0600); err != nil {
if err := os.WriteFile(to, buf, 0600); err != nil {
return fmt.Errorf("failed to write data to %q: %w", to, err)
}

Expand Down
7 changes: 3 additions & 4 deletions internal/action/binary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package action
import (
"bytes"
"context"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
Expand Down Expand Up @@ -88,7 +87,7 @@ func TestBinaryCat(t *testing.T) {
})

t.Run("compare output", func(t *testing.T) {
buf, err := ioutil.ReadFile(stdinfile)
buf, err := os.ReadFile(stdinfile)
require.NoError(t, err)
sec, err := act.binaryGet(ctx, "baz")
require.NoError(t, err)
Expand Down Expand Up @@ -118,7 +117,7 @@ func TestBinaryCopy(t *testing.T) {
defer buf.Reset()

infile := filepath.Join(u.Dir, "input.txt")
assert.NoError(t, ioutil.WriteFile(infile, []byte("0xDEADBEEF\n"), 0644))
assert.NoError(t, os.WriteFile(infile, []byte("0xDEADBEEF\n"), 0644))
assert.NoError(t, act.binaryCopy(ctx, gptest.CliCtx(ctx, t), infile, "txt", true))
})

Expand Down Expand Up @@ -198,5 +197,5 @@ func writeBinfile(t *testing.T, fn string) {
n, err := rand.Read(buf)
assert.NoError(t, err)
assert.Equal(t, size, n)
assert.NoError(t, ioutil.WriteFile(fn, buf, 0644))
assert.NoError(t, os.WriteFile(fn, buf, 0644))
}
3 changes: 1 addition & 2 deletions internal/action/clone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package action
import (
"bytes"
"context"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -30,7 +29,7 @@ func aGitRepo(ctx context.Context, u *gptest.Unit, t *testing.T, name string) st
assert.Error(t, err)

idf := filepath.Join(gd, ".gpg-id")
assert.NoError(t, ioutil.WriteFile(idf, []byte("0xDEADBEEF"), 0600))
assert.NoError(t, os.WriteFile(idf, []byte("0xDEADBEEF"), 0600))

gr, err := git.Init(ctx, gd, "Nobody", "foo.bar@example.org")
assert.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions internal/action/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package action
import (
"context"
"fmt"
"io/ioutil"
"os"

"github.com/fatih/color"
"github.com/gopasspw/gopass/internal/backend"
Expand Down Expand Up @@ -172,7 +172,7 @@ func (s *Action) initExportPublicKey(ctx context.Context, crypto backend.Crypto,
if err != nil {
return fmt.Errorf("failed to export public key: %w", err)
}
if err := ioutil.WriteFile(fn, pk, 06444); err != nil {
if err := os.WriteFile(fn, pk, 06444); err != nil {
out.Errorf(ctx, "❌ Failed to export public key %q: %q", fn, err)
return err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/backend/crypto/age/decrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"os"

"filippo.io/age"
"github.com/gopasspw/gopass/pkg/ctxutil"
Expand Down Expand Up @@ -42,7 +42,7 @@ func (a *Age) decrypt(ciphertext []byte, ids ...age.Identity) ([]byte, error) {
}

func (a *Age) decryptFile(ctx context.Context, filename string) ([]byte, error) {
ciphertext, err := ioutil.ReadFile(filename)
ciphertext, err := os.ReadFile(filename)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/backend/crypto/age/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"context"
"fmt"
"io/ioutil"
"os"

"filippo.io/age"
"github.com/gopasspw/gopass/pkg/ctxutil"
Expand Down Expand Up @@ -78,5 +78,5 @@ func (a *Age) encryptFile(ctx context.Context, filename string, plaintext []byte
return err
}

return ioutil.WriteFile(filename, buf, 0600)
return os.WriteFile(filename, buf, 0600)
}
7 changes: 3 additions & 4 deletions internal/backend/crypto/age/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package age

import (
"context"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand All @@ -26,7 +25,7 @@ func (a *Age) getSSHIdentities(ctx context.Context) (map[string]age.Identity, er
return nil, err
}
sshDir := filepath.Join(uhd, ".ssh")
files, err := ioutil.ReadDir(sshDir)
files, err := os.ReadDir(sshDir)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -54,11 +53,11 @@ func (a *Age) parseSSHIdentity(ctx context.Context, pubFn string) (string, age.I
if err != nil {
return "", nil, err
}
pubBuf, err := ioutil.ReadFile(pubFn)
pubBuf, err := os.ReadFile(pubFn)
if err != nil {
return "", nil, err
}
privBuf, err := ioutil.ReadFile(privFn)
privBuf, err := os.ReadFile(privFn)
if err != nil {
return "", nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions internal/backend/crypto/plain/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package plain

import (
"context"
"io/ioutil"
"os"
"testing"

Expand All @@ -14,7 +13,7 @@ import (
)

func TestPlain(t *testing.T) {
td, err := ioutil.TempDir("", "gopass-")
td, err := os.MkdirTemp("", "gopass-")
require.NoError(t, err)
defer func() {
_ = os.RemoveAll(td)
Expand Down
5 changes: 2 additions & 3 deletions internal/backend/crypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package backend

import (
"context"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -14,7 +13,7 @@ import (
func TestDetectCrypto(t *testing.T) {
ctx := context.Background()

td, err := ioutil.TempDir("", "gopass-")
td, err := os.MkdirTemp("", "gopass-")
require.NoError(t, err)
defer func() {
_ = os.RemoveAll(td)
Expand All @@ -40,7 +39,7 @@ func TestDetectCrypto(t *testing.T) {
fsDir := filepath.Join(td, "fs")
os.RemoveAll(fsDir)
assert.NoError(t, os.MkdirAll(fsDir, 0700))
assert.NoError(t, ioutil.WriteFile(filepath.Join(fsDir, tc.file), []byte("foo"), 0600))
assert.NoError(t, os.WriteFile(filepath.Join(fsDir, tc.file), []byte("foo"), 0600))

r, err := DetectStorage(ctx, fsDir)
assert.NoError(t, err)
Expand Down
Loading

0 comments on commit 73ed2c1

Please sign in to comment.