Code Monkey home page Code Monkey logo

Comments (2)

bluecmd avatar bluecmd commented on June 1, 2024

I made grpc.go into its own binary:

[bluecmd]$ cat cmd/test/grpc.go
// Copyright 2018 the u-root Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"context"
	"log"
	"net"

	pb "github.com/u-root/u-bmc/proto"
	"google.golang.org/grpc"
	"google.golang.org/grpc/reflection"
)

type mgmtServer struct {

}

func (m *mgmtServer) PressButton(ctx context.Context, r *pb.ButtonPressRequest) (*pb.ButtonPressResponse, error) {
	log.Printf("Request: %v", *r)
	return &pb.ButtonPressResponse{}, nil
}

func main() {
	// TODO(bluecmd): Since we have no RNG, no configuration, etc
	// only use http for now
	l, err := net.Listen("tcp", "[::]:8080")
	if err != nil {
		log.Fatalf("could not listen: %v", err)
	}

	s := mgmtServer{}

	g := grpc.NewServer()
	pb.RegisterManagementServiceServer(g, &s)
	reflection.Register(g)
	g.Serve(l)
}

Building it with vendor/ present and call grpc_cli.

[bluecmd]$ grpc_cli call localhost:8080 bmc.ManagementService.PressButton 'button: POWER, duration_ms: 1000'
Method name not found
Failed to find method bmc.ManagementService.PressButton in proto files.
Method name not found
Method name not found
Failed to parse request.

Without vendor/:

[bluecmd]$ rm -fr ../../vendor/
[bluecmd]$ go build
[bluecmd]$ ./test &
[bluecmd]$ grpc_cli call localhost:8080 bmc.ManagementService.PressButton 'button: POWER, duration_ms: 1000'
connecting to localhost:8080

Rpc succeeded with OK status

from u-bmc.

bluecmd avatar bluecmd commented on June 1, 2024

Mitigated for now by removing vendoring

from u-bmc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.