Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/symfony-cli/phpstore
go 1.17

require (
github.com/hashicorp/go-version v1.3.0
github.com/hashicorp/go-version v1.6.0
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/errors v0.9.1
gopkg.in/yaml.v2 v2.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw=
github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down
7 changes: 3 additions & 4 deletions store.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"sort"
Expand Down Expand Up @@ -200,7 +199,7 @@ func (s *PHPStore) loadVersions() {
// disk cache?
cache := filepath.Join(s.configDir, "php_versions.json")
if _, err := os.Stat(cache); err == nil {
if contents, err := ioutil.ReadFile(cache); err == nil {
if contents, err := os.ReadFile(cache); err == nil {
var vs versions
if err := json.Unmarshal(contents, &vs); err == nil {
for _, v := range vs {
Expand All @@ -222,7 +221,7 @@ func (s *PHPStore) loadVersions() {
s.discover()
sort.Sort(s.versions)
if contents, err := json.MarshalIndent(s.versions, "", " "); err == nil {
_ = ioutil.WriteFile(cache, contents, 0644)
_ = os.WriteFile(cache, contents, 0644)
}
}

Expand Down Expand Up @@ -282,7 +281,7 @@ func (s *PHPStore) readVersion(file string) []byte {
if _, err := os.Stat(file); err != nil {
return nil
}
contents, err := ioutil.ReadFile(file)
contents, err := os.ReadFile(file)
if err != nil {
return nil
}
Expand Down