wire/cmd/wire: rename from gowire (google/go-cloud#217)
@cflewis and @bradfitz were right: drop the "go". It's cleaner.
This commit is contained in:
14
README.md
14
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
|
||||
|
||||
@@ -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")
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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 {
|
||||
|
||||
2
wire.go
2
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.
|
||||
|
||||
Reference in New Issue
Block a user