From 1de1d101c743a097b81e19d0f860364144ac780c Mon Sep 17 00:00:00 2001 From: Ross Light Date: Mon, 23 Jul 2018 11:07:27 -0700 Subject: [PATCH] wire/cmd/wire: rename from gowire (google/go-cloud#217) @cflewis and @bradfitz were right: drop the "go". It's cleaner. --- README.md | 14 +++++++------- cmd/{gowire => wire}/main.go | 8 ++++---- internal/wire/testdata/CopyOtherDecls/foo/foo.go | 2 +- internal/wire/wire.go | 4 ++-- internal/wire/wire_test.go | 2 +- wire.go | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) rename cmd/{gowire => wire}/main.go (97%) diff --git a/README.md b/README.md index 58ce286..93cffaa 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ initialization. ## Installing -Install `gowire` by running the following: +Install Wire by running: ```shell -go get github.com/google/go-cloud/wire/cmd/gowire +go get github.com/google/go-cloud/wire/cmd/wire ``` ## Basics @@ -156,19 +156,19 @@ used during code generation for that injector. Any non-injector declarations found in a file with injectors will be copied into the generated file. -You can generate the injector by invoking `gowire` in the package directory: +You can generate the injector by invoking Wire in the package directory: ```shell -gowire +wire ``` Wire will produce an implementation of the injector in a file called `wire_gen.go` that looks something like this: ```go -// Code generated by gowire. DO NOT EDIT. +// Code generated by Wire. DO NOT EDIT. -//go:generate gowire +//go:generate wire //+build !wireinject package main @@ -314,7 +314,7 @@ func injectFoo() Foo { It's important to note that the expression will be copied to the injector's package; references to variables will be evaluated during the injector -package's initialization. `gowire` will emit an error if the expression calls +package's initialization. Wire will emit an error if the expression calls any functions or receives from any channels. ### Cleanup functions diff --git a/cmd/gowire/main.go b/cmd/wire/main.go similarity index 97% rename from cmd/gowire/main.go rename to cmd/wire/main.go index 43fa6e8..0c8f5d2 100644 --- a/cmd/gowire/main.go +++ b/cmd/wire/main.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// gowire is a compile-time dependency injection tool. +// Wire is a compile-time dependency injection tool. // // For an overview, see https://github.com/google/go-cloud/blob/master/wire/README.md package main @@ -53,11 +53,11 @@ func main() { case len(os.Args) == 3 && os.Args[1] == "gen": err = generate(os.Args[2]) default: - fmt.Fprintln(os.Stderr, "gowire: usage: gowire [gen] [PKG] | gowire show [...] | gowire check [...]") + fmt.Fprintln(os.Stderr, "usage: wire [gen] [PKG] | wire show [...] | wire check [...]") os.Exit(64) } if err != nil { - fmt.Fprintln(os.Stderr, "gowire:", err) + fmt.Fprintln(os.Stderr, "wire:", err) os.Exit(1) } } @@ -80,7 +80,7 @@ func generate(pkg string) error { } if len(out) == 0 { // No Wire directives, don't write anything. - fmt.Fprintln(os.Stderr, "gowire: no injector found for", pkg) + fmt.Fprintln(os.Stderr, "wire: no injector found for", pkg) return nil } p := filepath.Join(pkgInfo.Dir, "wire_gen.go") diff --git a/internal/wire/testdata/CopyOtherDecls/foo/foo.go b/internal/wire/testdata/CopyOtherDecls/foo/foo.go index 4a5a383..3851c92 100644 --- a/internal/wire/testdata/CopyOtherDecls/foo/foo.go +++ b/internal/wire/testdata/CopyOtherDecls/foo/foo.go @@ -15,7 +15,7 @@ //+build wireinject // All of the declarations are in one file. -// gowire should copy non-injectors over, preserving imports. +// Wire should copy non-injectors over, preserving imports. package main diff --git a/internal/wire/wire.go b/internal/wire/wire.go index 8fe5cf5..b7a0596 100644 --- a/internal/wire/wire.go +++ b/internal/wire/wire.go @@ -158,8 +158,8 @@ func (g *gen) frame() []byte { return nil } var buf bytes.Buffer - buf.WriteString("// Code generated by gowire. DO NOT EDIT.\n\n") - buf.WriteString("//go:generate gowire\n") + buf.WriteString("// Code generated by Wire. DO NOT EDIT.\n\n") + buf.WriteString("//go:generate wire\n") buf.WriteString("//+build !wireinject\n\n") buf.WriteString("package ") buf.WriteString(g.prog.Package(g.currPackage).Pkg.Name()) diff --git a/internal/wire/wire_test.go b/internal/wire/wire_test.go index b596db5..c7cc719 100644 --- a/internal/wire/wire_test.go +++ b/internal/wire/wire_test.go @@ -68,7 +68,7 @@ func TestWire(t *testing.T) { t.Run(test.name, func(t *testing.T) { t.Parallel() - // Run gowire from a fake build context. + // Run Wire from a fake build context. bctx := test.buildContext() gen, errs := Generate(bctx, wd, test.pkg) if len(gen) > 0 { diff --git a/wire.go b/wire.go index 9b44887..f1e8e77 100644 --- a/wire.go +++ b/wire.go @@ -36,7 +36,7 @@ func NewSet(...interface{}) ProviderSet { // panic(wire.Build(otherpkg.FooSet, myProviderFunc)) // } func Build(...interface{}) string { - return "implementation not generated, run gowire" + return "implementation not generated, run wire" } // A Binding maps an interface to a concrete type.