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

Upgrade to golang 1.20 #633

Merged
merged 4 commits into from
Feb 25, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
go: ['1.17']
go: ['1.20']
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v3
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1.2

# Image page: <https://hub.docker.com/_/golang>
FROM golang:1.18-alpine as builder
FROM golang:1.20-alpine as builder

WORKDIR /src

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ $ docker run --rm -v "$(pwd):/mount:ro" \

### **[Not-recommended]** go install

Go v1.16 or later is required.
Go v1.20 or later is required.

``` sh
go install github.com/ktr0731/evans@latest
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/ktr0731/evans

go 1.17
go 1.20

require (
github.com/Songmu/gocredits v0.3.0
Expand Down
352 changes: 0 additions & 352 deletions go.sum

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/metadata"
)

Expand Down Expand Up @@ -117,7 +118,7 @@ type client struct {
func NewClient(addr, serverName string, useReflection, useTLS bool, cacert, cert, certKey string, headers map[string][]string) (Client, error) {
var opts []grpc.DialOption
if !useTLS {
opts = append(opts, grpc.WithInsecure())
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
} else { // Enable TLS authentication
var tlsCfg tls.Config
if cacert != "" {
Expand All @@ -143,12 +144,11 @@ func NewClient(addr, serverName string, useReflection, useTLS bool, cacert, cert
}

creds := credentials.NewTLS(&tlsCfg)
opts = append(opts, grpc.WithTransportCredentials(creds))

if serverName != "" {
if err := creds.OverrideServerName(serverName); err != nil {
return nil, errors.Wrapf(err, "failed to override the server name by '%s'", serverName)
}
opts = append(opts, grpc.WithAuthority(serverName))
}
opts = append(opts, grpc.WithTransportCredentials(creds))
}
ctx, cancel := context.WithTimeout(context.Background(), 7*time.Second)
defer cancel()
Expand Down
4 changes: 2 additions & 2 deletions grpc/grpcreflection/reflection.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ func getCtx(headers map[string][]string) context.Context {
// NewClient returns an instance of gRPC reflection client for gRPC protocol.
func NewClient(conn grpc.ClientConnInterface, headers map[string][]string) Client {
return &client{
client: gr.NewClient(getCtx(headers), grpc_reflection_v1alpha.NewServerReflectionClient(conn)),
client: gr.NewClientV1Alpha(getCtx(headers), grpc_reflection_v1alpha.NewServerReflectionClient(conn)),
}
}

// NewWebClient returns an instance of gRPC reflection client for gRPC-Web protocol.
func NewWebClient(conn *grpcweb.ClientConn, headers map[string][]string) Client {
return &client{
client: gr.NewClient(getCtx(headers), grpcweb_reflection_v1alpha.NewServerReflectionClient(conn)),
client: gr.NewClientV1Alpha(getCtx(headers), grpcweb_reflection_v1alpha.NewServerReflectionClient(conn)),
}
}

Expand Down