Skip to content

Commit

Permalink
Merge pull request #2002 from devhindo/gg
Browse files Browse the repository at this point in the history
Update Go version to 1.23 and replace ioutil with os package functions
  • Loading branch information
leecalcote authored Dec 30, 2024
2 parents 9ff1462 + ca44b13 commit 1534625
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/add-catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version: '1.23'

- name: Set env
run: |
Expand Down
2 changes: 1 addition & 1 deletion assets/artifact-hub-pkg/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module package.go

go 1.21.0
go 1.23

require (
github.com/Masterminds/semver/v3 v3.2.1
Expand Down
12 changes: 6 additions & 6 deletions assets/artifact-hub-pkg/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -114,7 +114,7 @@ func fetchCatalogPatterns() ([]byte, error) {
}
defer resp.Body.Close()

body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, ErrReadRespBody(err)
}
Expand Down Expand Up @@ -209,11 +209,11 @@ func decodeURIComponent(encodedURI string) (string, error) {

func writePatternFile(pattern CatalogPattern, versionDir, patternType, patternInfo, patternCaveats, compatibility, patternImageURL string) error {
designFilePath := filepath.Join(versionDir, "design.yml")
if err := ioutil.WriteFile(designFilePath, []byte(pattern.PatternFile), 0644); err != nil {
if err := os.WriteFile(designFilePath, []byte(pattern.PatternFile), 0644); err != nil {
return utils.ErrWriteFile(err, designFilePath)
}

contenttemp, err := ioutil.ReadFile(designFilePath)
contenttemp, err := os.ReadFile(designFilePath)
if err != nil {
return utils.ErrReadFile(err, designFilePath)
}
Expand Down Expand Up @@ -299,7 +299,7 @@ URL: 'https://raw.githubusercontent.com/meshery/meshery.io/master/%s/%s/%s/desig
downloadLink: %s/design.yml
---`, strings.TrimSpace(string(nameYAML)), version, pattern.UserID, userFullName, userInfo.AvatarURL, patternType, compatibility, pattern.ID, patternImageURL, patternInfo, patternCaveats, patternType, slugify(pattern.Name), pattern.ID, mesheryCatalogFilesDir, pattern.ID, version, pattern.ID)

if err := ioutil.WriteFile(fmt.Sprintf(filepath.Join("..", "..", "collections", "_catalog", patternType, pattern.ID+".md")), []byte(content), 0644); err != nil {
if err := os.WriteFile(fmt.Sprintf(filepath.Join("..", "..", "collections", "_catalog", patternType, pattern.ID+".md")), []byte(content), 0644); err != nil {
return utils.ErrWriteFile(err, filepath.Join("..", "..", "collections", "_catalog", patternType, pattern.ID+".md"))
}

Expand All @@ -314,7 +314,7 @@ func fetchUserInfo(userID string) (UserInfo, error) {
defer resp.Body.Close()

var userInfo UserInfo
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return UserInfo{}, ErrReadRespBody(err)
}
Expand Down

0 comments on commit 1534625

Please sign in to comment.