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

Build problems with metadata errors #12

Closed
ghost opened this issue Nov 18, 2015 · 1 comment
Closed

Build problems with metadata errors #12

ghost opened this issue Nov 18, 2015 · 1 comment

Comments

@ghost
Copy link

ghost commented Nov 18, 2015

Hi!
I'm using protobuf-3.0.0-beta1

Here is my build log of go-micro-services:

stalker@zombie ~/workspace/src/github.com/harlow/go-micro-services  > $ make -s
compiled: proto/auth/auth.proto
compiled: proto/geo/geo.proto
compiled: proto/profile/profile.proto
compiled: proto/rate/rate.proto

stalker@zombie ~/workspace/src/github.com/harlow/go-micro-services > $ make build
./build.sh
building cmd/api
building cmd/auth
# github.com/harlow/go-micro-services/cmd/auth
./main.go:37: cannot use md["traceID"] (type []string) as type string in field value
building cmd/geo
# github.com/harlow/go-micro-services/cmd/geo
./main.go:41: cannot use md["traceID"] (type []string) as type string in field value
building cmd/profile
# github.com/harlow/go-micro-services/cmd/profile
./main.go:35: cannot use md["traceID"] (type []string) as type string in field value
building cmd/rate
# github.com/harlow/go-micro-services/cmd/rate
./main.go:41: cannot use md["traceID"] (type []string) as type string in field value

Here is the code of cmd/auth.go:

33 // VerifyToken finds a customer by authentication token.
34 func (s *authServer) VerifyToken(ctx context.Context, args *auth.Args) (*auth.Customer, error) {
35         md, _ := metadata.FromContext(ctx)
36 
37         t := trace.Tracer{TraceID: md["traceID"]}
38         t.In(s.serverName, md["fromName"])
39         defer t.Out(md["fromName"], s.serverName, time.Now())
40 
41         customer := s.customers[args.AuthToken]
42         if customer == nil {
43                 return &auth.Customer{}, errors.New("Invalid Token")
44         }
45 
46         return customer, nil
47 }

The metadata["traceID"], metadata["fromName"] and so on...
obviously the []string array, so, it should be fixed?
Thanx, Alex!

@ghost ghost changed the title Build problems with protoc 3.0.0-beta1 Build problems with metadata errors Nov 18, 2015
harlow added a commit that referenced this issue Nov 21, 2015
The md[] interface appears to return a string[] now instead of string.

* Bump protobuf library, and re-build protos
* Flatten the md[] into strings before running tracers

#12
@harlow
Copy link
Owner

harlow commented Nov 21, 2015

Looks like there was a breaking change in the gRPC metadata:
grpc/grpc-go@484e2d9#diff-b3a9f1c1b5d5600f4924efe942b13fb0

@harlow harlow closed this as completed Nov 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant