lileio / lile Goto Github PK
View Code? Open in Web Editor NEWEasily generate gRPC services in Go ⚡️
License: MIT License
Easily generate gRPC services in Go ⚡️
License: MIT License
we've Jenkins X integration with lile now so folks can easily create lile microservices and have automated CI//CD pipelines with promotion to environments via GitOps etc.
However there's no Makefile
target to compile the code to a binary we can use.
How about we add a default build
goal which does this?
Let's take a look at your slack example and say we have two server:
ServerOne
implements Announce()
via gRPC interface (say to announce notif to slack)ServerTwo
needs a server to announce something to slack. It needs to call ServerOne
Well then, I build ServerOne
with lileio/lile
and get an autogenerated code in Go. Neat and pretty.
How about ServerTwo
? Hmmm its a bit tedious because:
ServerOne
, developer need to read and understand the proto file of ServerOne
. Good thing if ServerOne
developers kindly have an API docs.ServerOne
proto file which change the comminication contract between ServerOne
and ServerTwo
. Then these changes also affect the dependent microservice (ServerTwo
)There are two ideas for Go developer to resolve this:
ServerOne
do two version of API: the old schema and new schema. Allowing ServerTwo
to slowly migrate.ServerOne
can give its protofile to ServerTwo
and we can build a code generator for client side.I want to highlight on the (2) Ideas here and whether it should be supported, what are the Pros and Cons.
thrift
can yield freaking 50,000 lines of code justWe should set the port before log.
logrus.Infof("Prometheus metrics at :9000/metrics")
port := "9000"
if p := os.Getenv("PROMETHEUS_PORT"); p != "" {
port = p
}
Include Kubernetes DNS name, ENV var or a user override
protoc -I ./Protocols --lile-server_out=. --go_out=plugins=grpc:. .Protos/*.proto ;\
This generates only one test stub for the first file under /Protos. Expected output is creating as many stubs as number of files under /Protos
Find a way to enable some sort of "plugin" so for example, an service can be created with a setup cassandra database and migrator or with a JSON gateway
It would be nice if lile could be configured to generate a package path that does not use github.com
Hey!
Do you have plans to support Go 1.11 modules ?
Hi, It would be awesome to have grpc-gateway support
As discussed a consul integration would be nice. I am currently looking at a shutdown hook, to deregister the service. I can't seem to find, where do you stop the service?
I'm trying to run the command: protoc XXXX.proto --lile-server_out=. --go_out=plugins=grpc:.
I get this error:
protoc-gen-lile-server: program not found or is not executable
--lile-server_out: protoc-gen-lile-server: Plugin failed with status code 1.
why? I already have protobuf installed and also run the go get command for lile.
When there are multiple GOPATH, generate a template error。
I found this code:
templatePath = os.Getenv("GOPATH") + "/src/github.com/lileio/lile/protoc-gen-lile-server/templates"
D:/Go/bin/go.exe test -v [E:/gopath/src/github.com/jinq0123/users/server]
panic: listen unix /tmp/008531f5-cf69-11e7-a9eb-00ff198f3a8c: socket: An address incompatible with the requested protocol was used.
goroutine 1 [running]:
github.com/lileio/lile.NewTestServer(0xc042020c00, 0x0, 0x0, 0xc042020c00)
e:/gopath/src/github.com/lileio/lile/lile.go:147 +0x1bb
github.com/jinq0123/users/server.TestMain(0xc04206bf18)
e:/gopath/src/github.com/jinq0123/users/server/server_test.go:24 +0x73
main.main()
github.com/jinq0123/users/server/_test/_testmain.go:44 +0xe2
exit status 2
FAIL github.com/jinq0123/users/server 1.097s
Hi there! I wanted to propose adding the following badge to the README to indicate how many TODO
comments are in this codebase:
The badge links to tickgit.com
which is a free service that indexes and displays TODO comments in public github repos. It can help surface latent work and be a way for contributors to find areas of code to improve, that might not be otherwise documented.
The markdown is:
[![TODOs](https://badgen.net/https/api.tickgit.com/badgen/github.comgithub.com/lileio/lile)](https://www.tickgit.com/browse?repo=github.com/lileio/lile)
Thanks for considering, feel free to close this issue if it's not appropriate or you prefer not to!
If one tries to run lile-generated tests on Windows, lile will try to use a UNIX socket. This should use something like a named pipe (less realistic, more resilient) or an in-memory transport (more realistic, more complex).
Given a lile-generated test suite
When running go test
Then tests will execute successfully on Linux
and the tests will execute successfully on Windows
I would like to use dep or vgo to vendor the lile framework. unfortunately, both currently fail due to transitive package dependencies.
This is due to a transitive dependency on github.com/apache/thrift/lib/go and github.com/satori/go.uuid, where the authors broke the contract and did not increment the package version. dep ensure and vgo get create broken builds.
satori.uid, where the later version changes the NewV1() signature to return two variables (uid, error)
TProtobuff.Flush(ctx) now takes a context parameter
Would be helpful to include a normative Gopkg.toml/Gopkg.lock, and Go.mod .
I had to adjust the GoPkg files like so:
GoPkg.toml
[[override]]
name = "github.com/apache/thrift"
branch = "master"
[[override]]
name = "github.com/satori/go.uuid"
branch="master"
I want to import other protos like import "common/common.proto"; but it shows:
2019/03/20 18:23:02 No go_package option defined for import common/common.proto
--lile-server_out: protoc-gen-lile-server: Plugin failed with status code 1.
once I do not use lile the protoc works fine.
I tried to install the package but the terminal shows this:
# cd /home/user/go/src/google.golang.org/api; git pull --ff-only
From https://github.com/googleapis/google-api-go-client
* [new branch] master -> origin/master
* [new branch] release-v0.38.0 -> origin/release-v0.38.0
* [new tag] v0 -> v0
* [new tag] v0.1.0 -> v0.1.0
* [new tag] v0.10.0 -> v0.10.0
* [new tag] v0.11.0 -> v0.11.0
* [new tag] v0.12.0 -> v0.12.0
* [new tag] v0.13.0 -> v0.13.0
* [new tag] v0.14.0 -> v0.14.0
* [new tag] v0.15.0 -> v0.15.0
* [new tag] v0.16.0 -> v0.16.0
* [new tag] v0.17.0 -> v0.17.0
* [new tag] v0.18.0 -> v0.18.0
* [new tag] v0.19.0 -> v0.19.0
* [new tag] v0.2.0 -> v0.2.0
* [new tag] v0.20.0 -> v0.20.0
* [new tag] v0.21.0 -> v0.21.0
* [new tag] v0.22.0 -> v0.22.0
* [new tag] v0.23.0 -> v0.23.0
* [new tag] v0.24.0 -> v0.24.0
* [new tag] v0.25.0 -> v0.25.0
* [new tag] v0.26.0 -> v0.26.0
* [new tag] v0.27.0 -> v0.27.0
* [new tag] v0.28.0 -> v0.28.0
* [new tag] v0.29.0 -> v0.29.0
* [new tag] v0.3.0 -> v0.3.0
* [new tag] v0.3.1 -> v0.3.1
* [new tag] v0.3.1+alpha -> v0.3.1+alpha
* [new tag] v0.3.1-alpha -> v0.3.1-alpha
* [new tag] v0.3.2 -> v0.3.2
* [new tag] v0.30.0 -> v0.30.0
* [new tag] v0.31.0 -> v0.31.0
* [new tag] v0.32.0 -> v0.32.0
* [new tag] v0.33.0 -> v0.33.0
* [new tag] v0.34.0 -> v0.34.0
* [new tag] v0.35.0 -> v0.35.0
* [new tag] v0.36.0 -> v0.36.0
* [new tag] v0.37.0 -> v0.37.0
* [new tag] v0.4.0 -> v0.4.0
* [new tag] v0.5.0 -> v0.5.0
* [new tag] v0.6.0 -> v0.6.0
* [new tag] v0.7.0 -> v0.7.0
* [new tag] v0.8.0 -> v0.8.0
* [new tag] v0.9.0 -> v0.9.0
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
package google.golang.org/api/iterator: exit status 1
cannot find package "google.golang.org/api/option" in any of:
/usr/local/go/src/google.golang.org/api/option (from $GOROOT)
/home/user/go/src/google.golang.org/api/option (from $GOPATH)
cannot find package "google.golang.org/api/option/internaloption" in any of:
/usr/local/go/src/google.golang.org/api/option/internaloption (from $GOROOT)
/home/user/go/src/google.golang.org/api/option/internaloption (from $GOPATH)
cannot find package "google.golang.org/api/transport/grpc" in any of:
/usr/local/go/src/google.golang.org/api/transport/grpc (from $GOROOT)
/home/user/go/src/google.golang.org/api/transport/grpc (from $GOPATH)
cannot find package "google.golang.org/api/support/bundler" in any of:
/usr/local/go/src/google.golang.org/api/support/bundler (from $GOROOT)
/home/user/go/src/google.golang.org/api/support/bundler (from $GOPATH)```
Anything I can do?
Hi!
Could we rename lile.Service.Registery
to lile.Service.Registry
? I think it's a small typo error. 🐾
I can submit a PR for this too. 😇
I tried to generate a new service, but got this error:
$ protoc --version
libprotoc 3.5.1
$ lile new arne-cl/grpc-test
Creating project in /home/arne/go/src/github.com/arne-cl/grpc-test
Is this OK? [y]es/[n]o
y
[ERROR]: 1:13: expected ';', found '-'
Interestingly, if I use your example repo name, it works:
$ lile new lileio/slack
Creating project in /home/arne/go/src/github.com/lileio/slack
Is this OK? [y]es/[n]o
y
.
├── server
│ ├── server.go
│ └── server_test.go
├── subscribers
│ └── subscribers.go
├── slack
│ ├── cmd
│ │ ├── root.go
│ │ └── up.go
│ └── main.go
├── slack.proto
├── client.go
├── Makefile
├── Dockerfile
└── .gitignore
In README:
Getting Started
To generate a new service, run lile new with a short folder path.
$ lile new lileio/users
In real life:
➜ ~ lile new piotrkochan/lile-test
Error: required flag(s) "name" not set
Trying with --name
arg as in example (--name string the module name i.e (github.com/username/project
):
➜ ~ lile new piotrkochan/lile-test --name "github.com/piotrkochan/lile-test"
Creating project in lile-test
Is this OK? [y]es/[n]o
Y
[...some code output...]
Could not format Go file {client.go lile-test/client.go client.tmpl}
[ERROR]: 1:13: expected ';', found '-'
panic: 1:13: expected ';', found '-'
Other try:
➜ ~ lile new piotrkochan/lile-test --name "github.com/piotrkochan"
Creating project in piotrkochan
Is this OK? [y]es/[n]o
Y
.
├── server
│ ├── server.go
│ └── server_test.go
├── subscribers
│ └── subscribers.go
├── piotrkochan
│ ├── cmd
│ │ ├── root.go
│ │ └── up.go
│ └── main.go
├── piotrkochan.proto
├── client.go
├── Makefile
├── Dockerfile
├── go.mod
└── .gitignore
l➜ ~ pwd
<my home>
l➜ ~ ls -l | grep lile
drwxr-xr-x 4 piotr staff 128 Nov 20 20:55 lile-test
Generated code is not placed in $GOPATH as described but in the directory I'm currently in (is smart enough to parse your new service's name to create the service in the right place.
seems a little bit wrong :))
➜ ~ go version
go version go1.12.5 darwin/amd64
Problem: Running GO111MODULE=on go get -u github.com/lileio/lile/...
fails with:
go get: github.com/openzipkin/[email protected] updating to
github.com/openzipkin/[email protected]: parsing go.mod:
module declares its path as: github.com/openzipkin-contrib/zipkin-go-opentracing
but was required as: github.com/openzipkin/zipkin-go-opentracing
Solutions:
Short Term Fix: I haven't found one, adding the following to go.mod
replace (
github.com/openzipkin/zipkin-go-opentracing v0.3.4 => github.com/openzipkin-contrib/zipkin-go-opentracing v0.3.4
github.com/openzipkin/zipkin-go-opentracing v0.4.3 => github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.3
github.com/openzipkin/zipkin-go-opentracing v0.4.5 => github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5
)
leads to the following new error
go: github.com/openzipkin-contrib/[email protected] used for two different module paths (github.com/openzipkin-contrib/zipkin-go-opentracing and github.com/openzipkin/zipkin-go-opentracing)
Longer Term Fix:
github.com/openzipkin-contrib/zipkin-go-opentracing
and bump version if needed (GO111MODULE=on go get github.com/openzipkin-contrib/zipkin-go-opentracing@latest
). Happy to submit a PR if this feels like the right approach.When I try to use gogo along with lile (protoc -I../vendor -I ../models -I . ecommerce.proto --lile-server_out=. --gogo_out=plugins=grpc:$$GOPATH/src
)
I get
2017/09/29 18:35:42 No go_package option defined for import github.com/gogo/protobuf/gogoproto/gogo.proto
Lileio does not currently handle proto files containing go_package options of the following type as supported by this issue
option go_package = "github.com/example/foo;bar";
Some examples of such usage can be found in some common googleapis.
[jinqing@localhost src]$ go get -u github.com/lileio/lile/...
[jinqing@localhost src]$ lile new lileio/users
Creating project in /home/jinqing/go/src/github.com/lileio/users
Is this OK? [y]es/[n]o
y
...
[jinqing@localhost users]$ make build
go build -o build/lileio/users lileio/users/main.go
stat lileio/users/main.go: no such file or directory
make: *** [build] Error 1
[jinqing@localhost users]$ cat Makefile
# vi: ft=make
GOPATH:=$(shell go env GOPATH)
.PHONY: proto test
proto:
go get github.com/golang/protobuf/protoc-gen-go
protoc -I . users.proto --lile-server_out=. --go_out=plugins=grpc:${GOPATH}/src
build: proto
go build -o build/lileio/users lileio/users/main.go
test:
@go get github.com/rakyll/gotest
gotest -p 1 -v ./...
[jinqing@localhost users]$ ls
client.go Dockerfile Makefile server subscribers users users.proto
[jinqing@localhost users]$ pwd
/home/jinqing/go/src/github.com/lileio/users
[jinqing@localhost users]$
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.