Skip to content

Commit

Permalink
Merge pull request #373 from bojand/remove_ioutil
Browse files Browse the repository at this point in the history
remove usage of deprecated ioutil package
  • Loading branch information
bojand authored Sep 5, 2022
2 parents d5b9a60 + 571c27b commit fc8eca5
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading

0 comments on commit fc8eca5

Please sign in to comment.