1. gRPC 集成 func setupGRPC(app *gofr.App) { // 定义 gRPC 服务 server := grpc.NewServer() pb.RegisterUserServiceServer(server, &UserService{}) // 启动 gRPC 服务器 go func() { lis, err := net.Listen("tcp", ":50051") if err != nil { log.Fatalf("failed to listen: %v",...
比如果我们的项目是一个 grpc 服务,在 /cmd/myapp/main.go 中就包含了启动服务进程的代码,编译后生成的可执行文件就是 myapp。 不要在 /cmd 目录中放置太多的代码,我们应该将公有代码放置到 /pkg 中,将私有代码放置到 /internal 中并在 /cmd 中引入这些包,保证main 函数中的代码尽可能简单和少。 例子: ...
gRPC in Learn how easy it is to write a highly scalable distributed system that enforces type safety, SLA's, and more. Learn more Mastering Looking to go from zero to hero in a short time? This course is designed for senior developers to jumpstart your Go project. ...
gRPC in Learn how easy it is to write a highly scalable distributed system that enforces type safety, SLA's, and more. Learn more Mastering Looking to go from zero to hero in a short time? This course is designed for senior developers to jumpstart your Go project. Learn more Custom ...
Golang developers have specialized expertise to efficiently architect, develop, and maintain high-performance applications tailored to your specific needs. With their deep understanding of Go's concurrency model, standard libraries, and best practices, dedicated Golang developers optimize app performance and...
In this book, we start covering production grade best practices of Microservices Architecture and explain when to use it. Then we talk about microservice communication patterns where gRPC comes to the stage. You will see complete examples written in Go with Hexagonal Architecture applied to project...
GO Concurrency Best Practices GO Goroutines Stopping Goroutines GO Goroutine vs Threads GO WaitGroup GO Fan Out Fan In Using Channels GO Channels (Part I) GO Channels (Part II) GO Buffered Channel GO comma ok idiom Working with Database GO MongoDB GO SQL GO SQLite3 ...
As with anything, opinions and best practices evolve. Suppose you see a valuable snippet from my post but don’t agree 100%. That’s ok, adopt what you want. To stay up to date with my “current” approach to project structure, I’d suggest following one of my Open Source projects, ...
gRPC Topics * Writing Secure Go Code Static Analysis The Empty Interface Iota & Enums Working with Files Working with Relational Databases Calling non-Go Code Working with Time Configuration Networking Sorting Building Regular Expressions Bill has been developing software professionally for more than 30...
If you plan to jump into this fascinating world, you must know how Go can help you to build REST APIs, use SQL/NoSQL databases, data streaming platforms, gRPC, design your own CLIs, or how to log your programs efficiently just to mention a few. Build Systems with GO: Everything a ...