mirror of
https://github.com/go-micro/go-micro.git
synced 2025-05-19 21:23:04 +02:00
Rename gomu to micro (#2325)
* Rename Gomu to Micro * docs: Remove license reference in CLI's README
This commit is contained in:
parent
efcda9a48c
commit
a3202b00ee
@ -1,11 +0,0 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
_ "github.com/asim/go-micro/cmd/gomu/cmd/cli/call"
|
||||
_ "github.com/asim/go-micro/cmd/gomu/cmd/cli/describe"
|
||||
_ "github.com/asim/go-micro/cmd/gomu/cmd/cli/generate"
|
||||
_ "github.com/asim/go-micro/cmd/gomu/cmd/cli/new"
|
||||
_ "github.com/asim/go-micro/cmd/gomu/cmd/cli/run"
|
||||
_ "github.com/asim/go-micro/cmd/gomu/cmd/cli/services"
|
||||
_ "github.com/asim/go-micro/cmd/gomu/cmd/cli/stream"
|
||||
)
|
@ -1,12 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/asim/go-micro/cmd/gomu/cmd"
|
||||
|
||||
// register commands
|
||||
_ "github.com/asim/go-micro/cmd/gomu/cmd/cli"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cmd.Run()
|
||||
}
|
2
cmd/gomu/.gitignore → cmd/micro/.gitignore
vendored
2
cmd/gomu/.gitignore → cmd/micro/.gitignore
vendored
@ -29,5 +29,5 @@ coverage.txt
|
||||
coverage.out
|
||||
|
||||
# ignore locally built binaries
|
||||
gomu
|
||||
dist
|
||||
micro
|
@ -1,6 +1,6 @@
|
||||
# Gomu
|
||||
# Micro CLI
|
||||
|
||||
Gomu is a helper tool for developing [Go Micro][1] projects.
|
||||
Micro CLI is the command line interface for developing [Go Micro][1] projects.
|
||||
|
||||
## Getting Started
|
||||
|
||||
@ -9,13 +9,13 @@ Gomu is a helper tool for developing [Go Micro][1] projects.
|
||||
Installation is done by using the [`go install`][3] command.
|
||||
|
||||
```bash
|
||||
go install github.com/asim/go-micro/cmd/gomu@latest
|
||||
go install github.com/asim/go-micro/cmd/micro@latest
|
||||
```
|
||||
|
||||
Let's create a new service using the `new` command.
|
||||
|
||||
```bash
|
||||
gomu new service helloworld
|
||||
micro new service helloworld
|
||||
```
|
||||
|
||||
Follow the on-screen instructions. Next, we can run the program.
|
||||
@ -23,13 +23,13 @@ Follow the on-screen instructions. Next, we can run the program.
|
||||
```bash
|
||||
cd helloworld
|
||||
make proto tidy
|
||||
gomu run
|
||||
micro run
|
||||
```
|
||||
|
||||
Finally we can call the service.
|
||||
|
||||
```bash
|
||||
gomu call helloworld Helloworld.Call '{"name": "John"}'
|
||||
micro call helloworld Helloworld.Call '{"name": "John"}'
|
||||
```
|
||||
|
||||
That's all you need to know to get started. Refer to the [Go Micro][1]
|
||||
@ -53,10 +53,10 @@ go install go-micro.dev/v4/cmd/protoc-gen-micro@latest
|
||||
|
||||
## Creating A Service
|
||||
|
||||
To create a new service, use the `gomu new service` command.
|
||||
To create a new service, use the `micro new service` command.
|
||||
|
||||
```bash
|
||||
$ gomu new service helloworld
|
||||
$ micro new service helloworld
|
||||
creating service helloworld
|
||||
|
||||
download protoc zip packages (protoc-$VERSION-$PLATFORM.zip) and install:
|
||||
@ -75,11 +75,11 @@ cd helloworld
|
||||
make proto tidy
|
||||
```
|
||||
|
||||
To create a new function, use the `gomu new function` command. Functions differ
|
||||
To create a new function, use the `micro new function` command. Functions differ
|
||||
from services in that they exit after returning.
|
||||
|
||||
```bash
|
||||
$ gomu new function helloworld
|
||||
$ micro new function helloworld
|
||||
creating function helloworld
|
||||
|
||||
download protoc zip packages (protoc-$VERSION-$PLATFORM.zip) and install:
|
||||
@ -101,11 +101,11 @@ make proto tidy
|
||||
### Jaeger
|
||||
|
||||
To create a new service with [Jaeger][7] integration, pass the `--jaeger` flag
|
||||
to the `gomu new service` or `gomu new function` commands. You may configure
|
||||
to the `micro new service` or `micro new function` commands. You may configure
|
||||
the Jaeger client using [environment variables][8].
|
||||
|
||||
```bash
|
||||
gomu new service --jaeger helloworld
|
||||
micro new service --jaeger helloworld
|
||||
```
|
||||
|
||||
You may invoke `trace.NewSpan(context.Context).Finish()` to nest spans. For
|
||||
@ -143,7 +143,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/asim/go-micro/cmd/gomu/debug/trace"
|
||||
"github.com/asim/go-micro/cmd/micro/debug/trace"
|
||||
)
|
||||
|
||||
func Greet(ctx context.Context, name string) string {
|
||||
@ -155,19 +155,19 @@ func Greet(ctx context.Context, name string) string {
|
||||
### Skaffold
|
||||
|
||||
To create a new service with [Skaffold][9] files, pass the `--skaffold` flag to
|
||||
the `gomu new service` or `gomu new function` commands.
|
||||
the `micro new service` or `micro new function` commands.
|
||||
|
||||
```bash
|
||||
gomu new service --skaffold helloworld
|
||||
micro new service --skaffold helloworld
|
||||
```
|
||||
|
||||
## Running A Service
|
||||
|
||||
To run a service, use the `gomu run` command to build and run your service
|
||||
To run a service, use the `micro run` command to build and run your service
|
||||
continuously.
|
||||
|
||||
```bash
|
||||
$ gomu run
|
||||
$ micro run
|
||||
2021-08-20 14:05:54 file=v3@v3.5.2/service.go:199 level=info Starting [service] helloworld
|
||||
2021-08-20 14:05:54 file=server/rpc_server.go:820 level=info Transport [http] Listening on [::]:34531
|
||||
2021-08-20 14:05:54 file=server/rpc_server.go:840 level=info Broker [http] Connected to 127.0.0.1:44975
|
||||
@ -199,11 +199,11 @@ skaffold dev
|
||||
|
||||
## Creating A Client
|
||||
|
||||
To create a new client, use the `gomu new client` command. The name is the
|
||||
To create a new client, use the `micro new client` command. The name is the
|
||||
service you'd like to create a client project for.
|
||||
|
||||
```bash
|
||||
$ gomu new client helloworld
|
||||
$ micro new client helloworld
|
||||
creating client helloworld
|
||||
cd helloworld-client
|
||||
make tidy
|
||||
@ -213,7 +213,7 @@ You may optionally pass the fully qualified package name of the service you'd
|
||||
like to create a client project for.
|
||||
|
||||
```bash
|
||||
$ gomu new client github.com/auditemarlow/helloworld
|
||||
$ micro new client github.com/auditemarlow/helloworld
|
||||
creating client helloworld
|
||||
cd helloworld-client
|
||||
make tidy
|
||||
@ -221,40 +221,40 @@ make tidy
|
||||
|
||||
## Running A Client
|
||||
|
||||
To run a client, use the `gomu run` command to build and run your client
|
||||
To run a client, use the `micro run` command to build and run your client
|
||||
continuously.
|
||||
|
||||
```bash
|
||||
$ gomu run
|
||||
$ micro run
|
||||
2021-09-03 12:52:23 file=helloworld-client/main.go:33 level=info msg:"Hello John"
|
||||
```
|
||||
|
||||
## Generating Files
|
||||
|
||||
To generate Go Micro project template files after the fact, use the `gomu
|
||||
To generate Go Micro project template files after the fact, use the `micro
|
||||
generate` command. It will place the generated files in the current working
|
||||
directory.
|
||||
|
||||
```bash
|
||||
$ gomu generate skaffold
|
||||
$ micro generate skaffold
|
||||
skaffold project template files generated
|
||||
```
|
||||
|
||||
## Listing Services
|
||||
|
||||
To list services, use the `gomu services` command.
|
||||
To list services, use the `micro services` command.
|
||||
|
||||
```bash
|
||||
$ gomu services
|
||||
$ micro services
|
||||
helloworld
|
||||
```
|
||||
|
||||
## Describing A Service
|
||||
|
||||
To describe a service, use the `gomu describe service` command.
|
||||
To describe a service, use the `micro describe service` command.
|
||||
|
||||
```bash
|
||||
$ gomu describe service helloworld
|
||||
$ micro describe service helloworld
|
||||
{
|
||||
"name": "helloworld",
|
||||
"version": "latest",
|
||||
@ -305,7 +305,7 @@ $ gomu describe service helloworld
|
||||
You may pass the `--format=yaml` flag to output a YAML formatted object.
|
||||
|
||||
```bash
|
||||
$ gomu describe service --format=yaml helloworld
|
||||
$ micro describe service --format=yaml helloworld
|
||||
name: helloworld
|
||||
version: latest
|
||||
metadata: {}
|
||||
@ -338,19 +338,19 @@ nodes:
|
||||
|
||||
## Calling A Service
|
||||
|
||||
To call a service, use the `gomu call` command. This will send a single request
|
||||
To call a service, use the `micro call` command. This will send a single request
|
||||
and expect a single response.
|
||||
|
||||
```bash
|
||||
$ gomu call helloworld Helloworld.Call '{"name": "John"}'
|
||||
$ micro call helloworld Helloworld.Call '{"name": "John"}'
|
||||
{"msg":"Hello John"}
|
||||
```
|
||||
|
||||
To call a service's server stream, use the `gomu stream server` command. This
|
||||
To call a service's server stream, use the `micro stream server` command. This
|
||||
will send a single request and expect a stream of responses.
|
||||
|
||||
```bash
|
||||
$ gomu stream server helloworld Helloworld.ServerStream '{"count": 10}'
|
||||
$ micro stream server helloworld Helloworld.ServerStream '{"count": 10}'
|
||||
{"count":0}
|
||||
{"count":1}
|
||||
{"count":2}
|
||||
@ -363,20 +363,16 @@ $ gomu stream server helloworld Helloworld.ServerStream '{"count": 10}'
|
||||
{"count":9}
|
||||
```
|
||||
|
||||
To call a service's bidirectional stream, use the `gomu stream bidi` command.
|
||||
To call a service's bidirectional stream, use the `micro stream bidi` command.
|
||||
This will send a stream of requests and expect a stream of responses.
|
||||
|
||||
```bash
|
||||
$ gomu stream bidi helloworld Helloworld.BidiStream '{"stroke": 1}' '{"stroke": 2}' '{"stroke": 3}'
|
||||
$ micro stream bidi helloworld Helloworld.BidiStream '{"stroke": 1}' '{"stroke": 2}' '{"stroke": 3}'
|
||||
{"stroke":1}
|
||||
{"stroke":2}
|
||||
{"stroke":3}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This software is published under the [MIT license][10].
|
||||
|
||||
[1]: https://go-micro.dev
|
||||
[2]: https://golang.org/dl/
|
||||
[3]: https://golang.org/cmd/go/#hdr-Compile_and_install_packages_and_dependencies
|
||||
@ -386,4 +382,3 @@ This software is published under the [MIT license][10].
|
||||
[7]: https://www.jaegertracing.io/
|
||||
[8]: https://github.com/jaegertracing/jaeger-client-go#environment-variables
|
||||
[9]: https://skaffold.dev/
|
||||
[10]: LICENSE
|
@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/asim/go-micro/cmd/gomu/cmd"
|
||||
"github.com/asim/go-micro/cmd/micro/cmd"
|
||||
"go-micro.dev/v4"
|
||||
"go-micro.dev/v4/client"
|
||||
"github.com/urfave/cli/v2"
|
11
cmd/micro/cmd/cli/cli.go
Normal file
11
cmd/micro/cmd/cli/cli.go
Normal file
@ -0,0 +1,11 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
_ "github.com/asim/go-micro/cmd/micro/cmd/cli/call"
|
||||
_ "github.com/asim/go-micro/cmd/micro/cmd/cli/describe"
|
||||
_ "github.com/asim/go-micro/cmd/micro/cmd/cli/generate"
|
||||
_ "github.com/asim/go-micro/cmd/micro/cmd/cli/new"
|
||||
_ "github.com/asim/go-micro/cmd/micro/cmd/cli/run"
|
||||
_ "github.com/asim/go-micro/cmd/micro/cmd/cli/services"
|
||||
_ "github.com/asim/go-micro/cmd/micro/cmd/cli/stream"
|
||||
)
|
@ -1,7 +1,7 @@
|
||||
package describe
|
||||
|
||||
import (
|
||||
"github.com/asim/go-micro/cmd/gomu/cmd"
|
||||
"github.com/asim/go-micro/cmd/micro/cmd"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/asim/go-micro/cmd/gomu/cmd"
|
||||
"github.com/asim/go-micro/cmd/micro/cmd"
|
||||
"github.com/urfave/cli/v2"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
@ -6,9 +6,9 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/asim/go-micro/cmd/gomu/cmd"
|
||||
"github.com/asim/go-micro/cmd/gomu/generator"
|
||||
tmpl "github.com/asim/go-micro/cmd/gomu/generator/template"
|
||||
"github.com/asim/go-micro/cmd/micro/cmd"
|
||||
"github.com/asim/go-micro/cmd/micro/generator"
|
||||
tmpl "github.com/asim/go-micro/cmd/micro/generator/template"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
@ -6,9 +6,9 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/asim/go-micro/cmd/gomu/cmd"
|
||||
"github.com/asim/go-micro/cmd/gomu/generator"
|
||||
tmpl "github.com/asim/go-micro/cmd/gomu/generator/template"
|
||||
"github.com/asim/go-micro/cmd/micro/cmd"
|
||||
"github.com/asim/go-micro/cmd/micro/generator"
|
||||
tmpl "github.com/asim/go-micro/cmd/micro/generator/template"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
@ -7,11 +7,11 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/asim/go-micro/cmd/gomu/cmd"
|
||||
"go-micro.dev/v4/runtime"
|
||||
"go-micro.dev/v4/runtime/local/git"
|
||||
"github.com/asim/go-micro/cmd/micro/cmd"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/urfave/cli/v2"
|
||||
"go-micro.dev/v4/runtime"
|
||||
"go-micro.dev/v4/runtime/local/git"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -36,7 +36,7 @@ var (
|
||||
func init() {
|
||||
cmd.Register(&cli.Command{
|
||||
Name: "run",
|
||||
Usage: "Build and run a service continuously, e.g. gomu run [github.com/auditemarlow/helloworld]",
|
||||
Usage: "Build and run a service continuously, e.g. " + cmd.App().Name + " run [github.com/auditemarlow/helloworld]",
|
||||
Flags: flags,
|
||||
Action: Run,
|
||||
})
|
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/asim/go-micro/cmd/gomu/cmd"
|
||||
"github.com/asim/go-micro/cmd/micro/cmd"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package stream
|
||||
|
||||
import (
|
||||
"github.com/asim/go-micro/cmd/gomu/cmd"
|
||||
"github.com/asim/go-micro/cmd/micro/cmd"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
@ -4,15 +4,15 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
mcmd "go-micro.dev/v4/cmd"
|
||||
"github.com/urfave/cli/v2"
|
||||
mcmd "go-micro.dev/v4/cmd"
|
||||
)
|
||||
|
||||
var (
|
||||
// DefaultCmd is the default, unmodified root command.
|
||||
DefaultCmd Cmd = NewCmd()
|
||||
|
||||
name string = "gomu"
|
||||
name string = "micro"
|
||||
description string = "The Go Micro CLI tool"
|
||||
version string = "latest"
|
||||
)
|
@ -50,7 +50,7 @@ import (
|
||||
{{end}} "go-micro.dev/v4"
|
||||
log "go-micro.dev/v4/logger"{{if .Jaeger}}
|
||||
|
||||
"github.com/asim/go-micro/cmd/gomu/debug/trace/jaeger"{{end}}
|
||||
"github.com/asim/go-micro/cmd/micro/debug/trace/jaeger"{{end}}
|
||||
)
|
||||
|
||||
var (
|
||||
@ -102,7 +102,7 @@ import (
|
||||
{{end}} "go-micro.dev/v4"
|
||||
log "go-micro.dev/v4/logger"{{if .Jaeger}}
|
||||
|
||||
"github.com/asim/go-micro/cmd/gomu/debug/trace/jaeger"{{end}}
|
||||
"github.com/asim/go-micro/cmd/micro/debug/trace/jaeger"{{end}}
|
||||
)
|
||||
|
||||
var (
|
@ -1,4 +1,4 @@
|
||||
module github.com/asim/go-micro/cmd/gomu
|
||||
module github.com/asim/go-micro/cmd/micro
|
||||
|
||||
go 1.16
|
||||
|
||||
@ -12,3 +12,5 @@ require (
|
||||
go-micro.dev/v4 v4.1.0
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
)
|
||||
|
||||
replace github.com/asim/go-micro/cmd/micro => ../
|
@ -142,7 +142,6 @@ github.com/exoscale/egoscale v0.46.0/go.mod h1:mpEXBpROAa/2i5GC0r33rfxG+TxSEka11
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
@ -558,7 +557,6 @@ golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u0
|
||||
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
@ -752,9 +750,7 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
|
||||
gonum.org/v1/gonum v0.8.2 h1:CCXrcPKiGGotvnN6jfUsKk4rRqm7q09/YbKb5xCEvtM=
|
||||
gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0=
|
||||
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0 h1:OE9mWmgKkjJyEmDAAtGMPjXu+YNeGvK9VTSHY6+Qihc=
|
||||
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
|
||||
gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=
|
||||
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
|
12
cmd/micro/main.go
Normal file
12
cmd/micro/main.go
Normal file
@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/asim/go-micro/cmd/micro/cmd"
|
||||
|
||||
// register commands
|
||||
_ "github.com/asim/go-micro/cmd/micro/cmd/cli"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cmd.Run()
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user