goose: add a test for imports across packages

Reviewed-by: Tuo Shan <shantuo@google.com>
Reviewed-by: Herbie Ong <herbie@google.com>
This commit is contained in:
Ross Light
2018-04-02 16:35:59 -07:00
parent b92ac73ae3
commit 50dbe5a65d
5 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
package bar
type Bar int
//goose:provide Bar
func ProvideBar() Bar {
return 1
}

View File

@@ -0,0 +1,26 @@
package main
import (
"fmt"
"bar"
)
func main() {
fmt.Println(injectFooBar())
}
type Foo int
type FooBar int
//goose:provide Set
func provideFoo() Foo {
return 41
}
//goose:import Set "bar".Bar
//goose:provide Set
func provideFooBar(foo Foo, barVal bar.Bar) FooBar {
return FooBar(foo) + FooBar(barVal)
}

View File

@@ -0,0 +1,7 @@
//+build gooseinject
package main
//goose:use Set
func injectFooBar() FooBar

View File

@@ -0,0 +1 @@
42

1
internal/goose/testdata/PkgImport/pkg vendored Normal file
View File

@@ -0,0 +1 @@
foo