Skip to content

Commit

Permalink
Upgrade to golang 1.19.13, and upgrade GRPC library to 1.59.0 (#245)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
  • Loading branch information
MarcosDY committed Oct 24, 2023
1 parent 86fd4c3 commit f992e00
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 1,548 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ apiprotos := \
# Toolchain
#############################################################################

go_version_full := 1.17.13
go_version_full := 1.19.12
go_version := $(go_version_full:.0=)
go_dir := $(build_dir)/go/$(go_version)

Expand Down
6 changes: 3 additions & 3 deletions v2/bundle/jwtbundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"crypto"
"encoding/json"
"io"
"io/ioutil"
"os"
"sync"

"github.com/go-jose/go-jose/v3"
Expand Down Expand Up @@ -43,7 +43,7 @@ func FromJWTAuthorities(trustDomain spiffeid.TrustDomain, jwtAuthorities map[str

// Load loads a bundle from a file on disk. The file must contain a standard RFC 7517 JWKS document.
func Load(trustDomain spiffeid.TrustDomain, path string) (*Bundle, error) {
bundleBytes, err := ioutil.ReadFile(path)
bundleBytes, err := os.ReadFile(path)
if err != nil {
return nil, jwtbundleErr.New("unable to read JWT bundle: %w", err)
}
Expand All @@ -53,7 +53,7 @@ func Load(trustDomain spiffeid.TrustDomain, path string) (*Bundle, error) {

// Read decodes a bundle from a reader. The contents must contain a standard RFC 7517 JWKS document.
func Read(trustDomain spiffeid.TrustDomain, r io.Reader) (*Bundle, error) {
b, err := ioutil.ReadAll(r)
b, err := io.ReadAll(r)
if err != nil {
return nil, jwtbundleErr.New("unable to read: %v", err)
}
Expand Down
3 changes: 1 addition & 2 deletions v2/bundle/jwtbundle/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package jwtbundle_test

import (
"crypto"
"io/ioutil"
"os"
"testing"

Expand Down Expand Up @@ -157,7 +156,7 @@ func TestParse(t *testing.T) {
testCase := testCase
t.Run(testCase.tf.filePath, func(t *testing.T) {
// we expect the ReadFile call to fail in some cases
bundleBytes, _ := ioutil.ReadFile(testCase.tf.filePath)
bundleBytes, _ := os.ReadFile(testCase.tf.filePath)

bundle, err := jwtbundle.Parse(td, bundleBytes)
if testCase.err != "" {
Expand Down
6 changes: 3 additions & 3 deletions v2/bundle/spiffebundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"crypto/x509"
"encoding/json"
"io"
"io/ioutil"
"os"
"sync"
"time"

Expand Down Expand Up @@ -58,7 +58,7 @@ func New(trustDomain spiffeid.TrustDomain) *Bundle {
// Load loads a bundle from a file on disk. The file must contain a JWKS
// document following the SPIFFE Trust Domain and Bundle specification.
func Load(trustDomain spiffeid.TrustDomain, path string) (*Bundle, error) {
bundleBytes, err := ioutil.ReadFile(path)
bundleBytes, err := os.ReadFile(path)
if err != nil {
return nil, spiffebundleErr.New("unable to read SPIFFE bundle: %w", err)
}
Expand All @@ -69,7 +69,7 @@ func Load(trustDomain spiffeid.TrustDomain, path string) (*Bundle, error) {
// Read decodes a bundle from a reader. The contents must contain a JWKS
// document following the SPIFFE Trust Domain and Bundle specification.
func Read(trustDomain spiffeid.TrustDomain, r io.Reader) (*Bundle, error) {
b, err := ioutil.ReadAll(r)
b, err := io.ReadAll(r)
if err != nil {
return nil, spiffebundleErr.New("unable to read: %v", err)
}
Expand Down
3 changes: 1 addition & 2 deletions v2/bundle/spiffebundle/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package spiffebundle_test
import (
"crypto"
"crypto/x509"
"io/ioutil"
"os"
"testing"
"time"
Expand Down Expand Up @@ -105,7 +104,7 @@ func TestParse(t *testing.T) {
testCase := testCase
t.Run(testCase.filePath, func(t *testing.T) {
// we expect the ReadFile call to fail in some cases
bundleBytes, _ := ioutil.ReadFile(testCase.filePath)
bundleBytes, _ := os.ReadFile(testCase.filePath)

bundle, err := spiffebundle.Parse(td, bundleBytes)
checkBundleProperties(t, err, testCase, bundle)
Expand Down
6 changes: 3 additions & 3 deletions v2/bundle/x509bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package x509bundle
import (
"crypto/x509"
"io"
"io/ioutil"
"os"
"sync"

"github.com/spiffe/go-spiffe/v2/internal/pemutil"
Expand Down Expand Up @@ -40,7 +40,7 @@ func FromX509Authorities(trustDomain spiffeid.TrustDomain, authorities []*x509.C
// Load loads a bundle from a file on disk. The file must contain PEM-encoded
// certificate blocks.
func Load(trustDomain spiffeid.TrustDomain, path string) (*Bundle, error) {
fileBytes, err := ioutil.ReadFile(path)
fileBytes, err := os.ReadFile(path)
if err != nil {
return nil, x509bundleErr.New("unable to load X.509 bundle file: %w", err)
}
Expand All @@ -51,7 +51,7 @@ func Load(trustDomain spiffeid.TrustDomain, path string) (*Bundle, error) {
// Read decodes a bundle from a reader. The contents must be PEM-encoded
// certificate blocks.
func Read(trustDomain spiffeid.TrustDomain, r io.Reader) (*Bundle, error) {
b, err := ioutil.ReadAll(r)
b, err := io.ReadAll(r)
if err != nil {
return nil, x509bundleErr.New("unable to read X.509 bundle: %v", err)
}
Expand Down
7 changes: 3 additions & 4 deletions v2/bundle/x509bundle/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package x509bundle_test

import (
"crypto/x509"
"io/ioutil"
"os"
"testing"

Expand Down Expand Up @@ -121,7 +120,7 @@ func TestParse(t *testing.T) {
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
fileBytes, err := ioutil.ReadFile(test.path)
fileBytes, err := os.ReadFile(test.path)
require.NoError(t, err)

bundle, err := x509bundle.Parse(td, fileBytes)
Expand Down Expand Up @@ -229,7 +228,7 @@ func TestMarshal(t *testing.T) {
require.NotNil(t, pemBytes)

// Load original bytes for comparison
expBytes, err := ioutil.ReadFile("testdata/certs.pem")
expBytes, err := os.ReadFile("testdata/certs.pem")
require.NoError(t, err)

// Assert the marshalled bundle is equal to the one loaded
Expand Down Expand Up @@ -320,7 +319,7 @@ func TestClone(t *testing.T) {
}

func loadRawCertificates(t *testing.T, path string) []byte {
certsBytes, err := ioutil.ReadFile(path)
certsBytes, err := os.ReadFile(path)
require.NoError(t, err)

certs, err := pemutil.ParseCertificates(certsBytes)
Expand Down
4 changes: 2 additions & 2 deletions v2/examples/spiffe-http/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"context"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"

Expand Down Expand Up @@ -53,7 +53,7 @@ func run(ctx context.Context) error {
}

defer r.Body.Close()
body, err := ioutil.ReadAll(r.Body)
body, err := io.ReadAll(r.Body)
if err != nil {
return fmt.Errorf("unable to read body: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions v2/examples/spiffe-jwt-using-proxy/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"context"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -90,7 +90,7 @@ func run(ctx context.Context) error {
return fmt.Errorf("unexpected status: %d", res.StatusCode)
}

body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
if err != nil {
return fmt.Errorf("error reading response body: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions v2/examples/spiffe-jwt/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"context"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -88,7 +88,7 @@ func run(ctx context.Context) error {
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
if err != nil {
return fmt.Errorf("error reading response body: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions v2/federation/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"crypto/x509"
"errors"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"strings"
Expand Down Expand Up @@ -126,7 +126,7 @@ func TestHandler(t *testing.T) {
require.NoError(t, err)
defer res.Body.Close()

actual, err := ioutil.ReadAll(res.Body)
actual, err := io.ReadAll(res.Body)
require.NoError(t, err)

switch {
Expand Down
6 changes: 3 additions & 3 deletions v2/go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module github.com/spiffe/go-spiffe/v2

go 1.17
go 1.19

require (
github.com/Microsoft/go-winio v0.6.1
github.com/go-jose/go-jose/v3 v3.0.0
github.com/stretchr/testify v1.8.4
github.com/zeebo/errs v1.3.0
google.golang.org/grpc v1.57.0
google.golang.org/grpc v1.59.0
google.golang.org/grpc/examples v0.0.0-20230224211313-3775f633ce20
google.golang.org/protobuf v1.31.0
)
Expand All @@ -23,7 +23,7 @@ require (
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit f992e00

Please sign in to comment.