lileio / lile

Easily generate gRPC services in Go ⚡️
MIT License
1.5k stars 88 forks source link

lile new throws [ERROR]: 1:13: expected ';', found '-' #40

Closed arne-cl closed 6 years ago

arne-cl commented 6 years ago

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
arne-cl commented 6 years ago

The issue seems to be the dash in repo name. If I use an underscore, it works:

$ 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
.
├── server
│   ├── server.go
│   └── server_test.go
├── subscribers
│   └── subscribers.go
├── grpc_test
│   ├── cmd
│   │   ├── root.go
│   │   └── up.go
│   └── main.go
├── grpc_test.proto
├── client.go
├── Makefile
├── Dockerfile
└── .gitignore
arbarlow commented 6 years ago

Hi @arne-cl, sure.

The issue that that go packages can't have - in them, we could either warn that this package name won't work, or we could generate an underscored name?

I feel we should probably warn

arne-cl commented 6 years ago

Hi @arbarlow,

that is a bit confusing, as lile new works with git repository names not go packages. (We have lots of golang repos at work with dashes in the repo names but underscores in the code base.)

Best regards, Arne

arbarlow commented 6 years ago

Hi @arne-cl, I've just released v2, which should help with this! Please give it a go and see if it generates what you'd expect it to generate 😄

arbarlow commented 6 years ago

hi @arne-cl, I haven't heard anything for a while so I'm closing this issue for now. Do let me know if it's still a problem!