Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove usage of deprecated ioutil package #373

Merged
merged 2 commits into from Sep 5, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Expand Up @@ -57,7 +57,7 @@ jobs:
key: ${{ runner.os }}-go-bin-${{ env.GOLANGCI_LINT_VERSION }}
- name: Install tparse
if: steps.cache-go-bin.outputs.cache-hit != 'true'
run: go get github.com/mfridman/tparse
run: go install github.com/mfridman/tparse
- name: Install golangci-lint
if: steps.cache-go-bin.outputs.cache-hit != 'true'
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $HOME/go/bin $GOLANGCI_LINT_VERSION
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Expand Up @@ -120,7 +120,7 @@ jobs:
run: |
# Temporary fix for https://github.com/actions/setup-go/issues/14
export PATH=$PATH:$(go env GOPATH)/bin
go get -u github.com/git-chglog/git-chglog/cmd/git-chglog
go install github.com/git-chglog/git-chglog/cmd/git-chglog
# git-chglog -c .chglog/config.yml $(git describe --tags $(git rev-list --tags --max-count=1))
git-chglog -c .chglog/config.yml ${{ env.RELEASE_VERSION }} > RELEASE-${{ env.RELEASE_VERSION }}.md
- name: Create GitHub release ${{ matrix.target }}
Expand Down
4 changes: 4 additions & 0 deletions .golangci.yml
Expand Up @@ -36,3 +36,7 @@ issues:
- path: protodesc/
text: "SA1019: package github.com/golang/protobuf"

# TODO fix protobuf deprecated
- path: runner/
text: "SA1019: \"github.com/golang/protobuf/jsonpb\" is deprecated"

4 changes: 2 additions & 2 deletions cmd/ghz/main.go
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"io"
"os"
"runtime"
"strconv"
Expand Down Expand Up @@ -396,7 +396,7 @@ func createConfigFromArgs(cfg *runner.Config) error {

var binaryData []byte
if *binData {
b, err := ioutil.ReadAll(os.Stdin)
b, err := io.ReadAll(os.Stdin)
if err != nil {
return err
}
Expand Down
13 changes: 7 additions & 6 deletions protodesc/protodesc.go
Expand Up @@ -3,7 +3,7 @@ package protodesc
import (
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"

Expand Down Expand Up @@ -43,7 +43,7 @@ func GetMethodDescFromProto(call, proto string, imports []string) (*desc.MethodD

// GetMethodDescFromProtoSet gets method descriptor for the given call symbol from protoset file given my path protoset
func GetMethodDescFromProtoSet(call, protoset string) (*desc.MethodDescriptor, error) {
b, err := ioutil.ReadFile(protoset)
b, err := os.ReadFile(protoset)
if err != nil {
return nil, fmt.Errorf("could not load protoset file %q: %v", protoset, err)
}
Expand Down Expand Up @@ -157,10 +157,11 @@ func findServiceSymbol(resolved map[string]*desc.FileDescriptor, fullyQualifiedN
// and the method name from the input string.
//
// valid inputs:
// package.Service.Method
// .package.Service.Method
// package.Service/Method
// .package.Service/Method
//
// package.Service.Method
// .package.Service.Method
// package.Service/Method
// .package.Service/Method
func parseServiceMethod(svcAndMethod string) (string, string, error) {
if len(svcAndMethod) == 0 {
return "", "", errNoMethodNameSpecified
Expand Down