cleanup: more simplifications (#2574)

This commit is contained in:
Doug Fawley
2019-01-16 13:07:56 -08:00
committed by GitHub
parent 4e92c060da
commit 59acad4c45
7 changed files with 7 additions and 19 deletions

View File

@ -96,10 +96,7 @@ func valid(authorization []string) bool {
// Perform the token validation here. For the sake of this example, the code
// here forgoes any of the usual OAuth2 token validation and instead checks
// for a token matching an arbitrary string.
if token != "some-secret-token" {
return false
}
return true
return token == "some-secret-token"
}
// ensureValidToken ensures a valid token exists within a request's metadata. If

View File

@ -89,10 +89,7 @@ func valid(authorization []string) bool {
// Perform the token validation here. For the sake of this example, the code
// here forgoes any of the usual OAuth2 token validation and instead checks
// for a token matching an arbitrary string.
if token != "some-secret-token" {
return false
}
return true
return token == "some-secret-token"
}
func unaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {

View File

@ -111,7 +111,7 @@ type exampleResolver struct {
func (r *exampleResolver) start() {
addrStrs := r.addrsStore[r.target.Endpoint]
addrs := make([]resolver.Address, len(addrStrs), len(addrStrs))
addrs := make([]resolver.Address, len(addrStrs))
for i, s := range addrStrs {
addrs[i] = resolver.Address{Addr: s}
}

View File

@ -119,7 +119,7 @@ type exampleResolver struct {
func (r *exampleResolver) start() {
addrStrs := r.addrsStore[r.target.Endpoint]
addrs := make([]resolver.Address, len(addrStrs), len(addrStrs))
addrs := make([]resolver.Address, len(addrStrs))
for i, s := range addrStrs {
addrs[i] = resolver.Address{Addr: s}
}