Commit Graph

15 Commits

Author SHA1 Message Date
Ross Light
64470a2452 wire/internal/wire: use on-disk GOPATH in generate tests (google/go-cloud#616)
The primary motivation is to permit a move to using go/packages instead
of go/loader. go/packages runs exclusively by shelling out to the go
tool, which precludes use of the in-memory "magic" GOPATH being used
up to this point.

This has a secondary effect of removing a lot of code to support "magic"
GOPATH from the test infrastructure. This is on the whole good, but
necessitated a change in the error scrubbing: since the filenames are
no longer fixed, error scrubbing also must remove the leading
$GOPATH/src lines.

Another related change: since all callers of Generate needed to know the
package path in order to write out wire_gen.go (necessitating a
find-only import search) and Generate already has this information,
Generate now returns this information to the caller. This should further
reduce callers' coupling to Wire's load internals. It also eliminates
code duplication.

This should hopefully shake out any difference in path separators for
running on Windows, but I have not tested that yet.

Updates google/go-cloud#78
Updates google/go-cloud#323
2018-11-13 13:16:46 -08:00
Ross Light
eedae3d8d0 all: change copyright notice to The Go Cloud Authors (google/go-cloud#306)
Added AUTHORS+CONTRIBUTORS files with the contributors already present
from the Git log.

Fixes google/go-cloud#225
2018-11-13 13:16:46 -08:00
Robert van Gent
3a3760180d wire: fill in ProviderSet.VarName when the set is a package variable (google/go-cloud#279)
Rename ProviderSet.Name to ProviderSet.VarName.

Fixes google/go-cloud#277
2018-11-13 13:16:46 -08:00
Issac Trotts
d214fc499d wire: show help when requested (google/go-cloud#238)
For now, it just shows usage.
2018-11-13 13:16:45 -08:00
Ross Light
1de1d101c7 wire/cmd/wire: rename from gowire (google/go-cloud#217)
@cflewis and @bradfitz were right: drop the "go". It's cleaner.
2018-11-13 13:16:45 -08:00
Ross Light
5f0dd9ee8f wire: add check command (google/go-cloud#207)
In the internal package, this expands the wire.Load function to run
the same solver as wire.Generate would on any injector function. For
completeness, I also print the injector functions in the gowire show
command.

A subsequent PR will add this as a step to Go Cloud CI.

Updates google/go-cloud#30
2018-11-13 13:16:45 -08:00
Ross Light
69b0cf53ad all: move back to github.com/google/go-cloud (google/go-cloud#162)
Reverts changes made in google/go-cloud#120 for google/go-cloud#117
2018-11-13 13:16:45 -08:00
Ross Light
0bf9b3b5dd all: fix docs and examples (google/go-cloud#141)
Most notably, adds examples for the blob package.
2018-11-13 13:16:45 -08:00
Ross Light
f7658c8a13 wire: change call sites to allow multiple errors (google/go-cloud#118)
Updated the call sites to allow multiple errors to be returned from
the package. Load is now permitted to return partial success.

Updates google/go-cloud#5
2018-11-13 13:16:45 -08:00
Ross Light
45a535a0bd all: s/go-cloud/go-x-cloud/ (google/go-cloud#120)
Fixes google/go-cloud#117
2018-11-13 13:16:45 -08:00
Ross Light
b12449f9e3 wire: build provider map incrementally (google/go-cloud#96)
One small breaking change: a provider set can no longer include an
interface binding to a concrete type that is not being provided
(directly or indirectly) by the provider set. I can't imagine a
reasonable use case for the previous behavior, so this likely will
catch more errors

In terms of operation, binding conflict error messages will now give
much more specific line numbers, since they will be reported closer to
where the problem occurred.

Now that provider sets gather this information, it can be exposed in
the package API. gowire now uses this information instead of
trying to build it itself.

Fixes google/go-cloud#29
2018-11-13 13:16:45 -08:00
Ross Light
6345348d86 wire: rename from Goose (google/go-cloud#59)
Rename Goose to wire, making it more obvious what the package does, and look more like the stdlib.

Fixes google/go-cloud#8
2018-11-13 13:16:45 -08:00
Ross Light
10676a814b goose: add goose.Value directive
Subsumes previous usage of goose.Optional.

Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Tuo Shan <shantuo@google.com>
2018-11-13 13:16:45 -08:00
Ross Light
235a7d8f80 goose: allow non-injector code to live along with injectors
Previously, goose would ignore declarations in the //+build gooseinject
files that were not injectors. This meant that if you wanted to write
application-specific providers, you would need to place them in a
separate file, away from the goose injectors. This means that a typical
application would have three handwritten files: one for the abstract
business logic, one for the platform-specific providers, one for the
platform-specific injector declarations.

This change allows the two platform-specific files to be merged into
one: the //+build gooseinject file. goose will now copy these
declarations out to goose_gen.go. This requires a bit of hackery, since
the generated file may have different identifiers for the imported
packages, so goose will do some light AST rewriting to address these
cases.

(Historical note: this was the first change made externally, so also in
here are the copyright headers and other housekeeping changes.)

Reviewed-by: Tuo Shan <shantuo@google.com>
Reviewed-by: kokoro <noreply+kokoro@google.com>
2018-11-13 13:15:58 -08:00
Ross Light
f8e446fa17 goose: use marker functions instead of comments
To avoid making this CL too large, I did not migrate the existing goose
comments through the repository.  This will be addressed in a subsequent
CL.

Reviewed-by: Tuo Shan <shantuo@google.com>
2018-11-12 14:09:56 -08:00