Skip to content

Commit

Permalink
Update dependency of Go to 1.19 (#487)
Browse files Browse the repository at this point in the history
* Update to Go 1.19

Signed-off-by: Karl Hepworth <karl.hepworth@gmail.com>

* gofmt

Signed-off-by: Karl Hepworth <karl.hepworth@gmail.com>

* Update deprecations

Signed-off-by: Karl Hepworth <karl.hepworth@gmail.com>

---------

Signed-off-by: Karl Hepworth <karl.hepworth@gmail.com>
  • Loading branch information
fubarhouse committed Oct 31, 2023
1 parent a5bfb19 commit f10f76f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: 1.19
-
name: Create version helper
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/pygmy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
stable: 'false'
go-version: '1.18'
go-version: '1.19'
- name: Install
run: go mod download
env:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/pygmystack/pygmy

go 1.18
go 1.19

require (
github.com/containerd/containerd v1.7.3
Expand Down
3 changes: 1 addition & 2 deletions service/interface/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"regexp"
"runtime"
Expand Down Expand Up @@ -432,7 +431,7 @@ func DockerExec(container string, command string) ([]byte, error) {
return []byte{}, err
}

data, _ := ioutil.ReadAll(response.Reader)
data, _ := io.ReadAll(response.Reader)
defer response.Close()
return data, nil

Expand Down
2 changes: 1 addition & 1 deletion service/library/dryrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type CompatibilityCheck struct {
}

// DryRun will check for. It is here to check for port compatibility before
//Pygmy attempts to start any containers and provide the user with a report.
// Pygmy attempts to start any containers and provide the user with a report.
func DryRun(c *Config) []CompatibilityCheck {

messages := []CompatibilityCheck{}
Expand Down
7 changes: 3 additions & 4 deletions service/resolv/resolv.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package resolv

import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"runtime"
Expand Down Expand Up @@ -60,7 +59,7 @@ func (resolv Resolv) Configure(c *model.Params) {

// Create the file if it doesn't exist.
if _, err := os.Stat(fullPath); os.IsNotExist(err) {
if tmpFile, err = ioutil.TempFile("", "pygmy-"); err != nil {
if tmpFile, err = os.CreateTemp("", "pygmy-"); err != nil {
fmt.Println(err)
}
if err = os.Chmod(tmpFile.Name(), 0777); err != nil {
Expand All @@ -87,7 +86,7 @@ func (resolv Resolv) Configure(c *model.Params) {
fmt.Println("/bin/sh", "-c", "cat "+fullPath)
}

if tmpFile, err = ioutil.TempFile("", "pygmy-"); err != nil {
if tmpFile, err = os.CreateTemp("", "pygmy-"); err != nil {
fmt.Println(err)
} else {
if err = os.Chmod(tmpFile.Name(), 0777); err != nil {
Expand Down Expand Up @@ -141,7 +140,7 @@ func (resolv Resolv) Clean() {
} else {
if strings.Contains(string(cmdOut), resolv.Data) {
newFile := strings.Replace(string(cmdOut), resolv.Data, "", -1)
if tmpFile, err := ioutil.TempFile("", "pygmy-"); err != nil {
if tmpFile, err := os.CreateTemp("", "pygmy-"); err != nil {
fmt.Println(err)
} else {
if err = os.Chmod(tmpFile.Name(), 0777); err != nil {
Expand Down
5 changes: 2 additions & 3 deletions service/ssh/agent/ssh_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package agent
import (
"errors"
"fmt"
"io/ioutil"
"os"
"strings"

Expand Down Expand Up @@ -59,7 +58,7 @@ func List(service model.Service) ([]byte, error) {
func Validate(filePath, passcode string) (bool, error) {

filePath = strings.TrimRight(filePath, ".pub")
content, err := ioutil.ReadFile(filePath)
content, err := os.ReadFile(filePath)
if err != nil {
fmt.Println("Err")
}
Expand All @@ -84,7 +83,7 @@ func Search(service model.Service, key string) (bool, error) {
result := false
if _, err := os.Stat(key); !os.IsNotExist(err) {
stripped := strings.Trim(key, ".pub")
data, err := ioutil.ReadFile(stripped + ".pub")
data, err := os.ReadFile(stripped + ".pub")
if err != nil {
return false, err
}
Expand Down

0 comments on commit f10f76f

Please sign in to comment.