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>
This commit is contained in:
6
internal/goose/testdata/Cleanup/foo/foo.go
vendored
6
internal/goose/testdata/Cleanup/foo/foo.go
vendored
@@ -1,6 +1,8 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
bar, cleanup := injectBar()
|
||||
@@ -12,14 +14,12 @@ func main() {
|
||||
type Foo int
|
||||
type Bar int
|
||||
|
||||
//goose:provide Foo
|
||||
func provideFoo() (*Foo, func()) {
|
||||
foo := new(Foo)
|
||||
*foo = 42
|
||||
return foo, func() { *foo = 0 }
|
||||
}
|
||||
|
||||
//goose:provide Bar
|
||||
func provideBar(foo *Foo) (*Bar, func()) {
|
||||
bar := new(Bar)
|
||||
*bar = 77
|
||||
|
||||
9
internal/goose/testdata/Cleanup/foo/goose.go
vendored
9
internal/goose/testdata/Cleanup/foo/goose.go
vendored
@@ -2,7 +2,10 @@
|
||||
|
||||
package main
|
||||
|
||||
//goose:use Foo
|
||||
//goose:use Bar
|
||||
import (
|
||||
"codename/goose"
|
||||
)
|
||||
|
||||
func injectBar() (*Bar, func())
|
||||
func injectBar() (*Bar, func()) {
|
||||
panic(goose.Use(provideFoo, provideBar))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user