goose: remove optional directive

This introduces some short-term pain in practice, but I aim to fix that
with the goose.Value directive.

Reviewed-by: Tuo Shan <shantuo@google.com>
This commit is contained in:
Ross Light
2018-04-26 14:23:06 -04:00
parent cfc6111ea5
commit 3345599aaf
20 changed files with 11 additions and 197 deletions

View File

@@ -1,16 +0,0 @@
package main
import "fmt"
func main() {
fmt.Println(injectBar())
}
type foo int
type bar int
//goose:provide
//goose:optional f
func provideBar(f foo) bar {
return bar(f)
}

View File

@@ -1,7 +0,0 @@
//+build gooseinject
package main
//goose:use provideBar
func injectBar() bar

View File

@@ -1 +0,0 @@
0

View File

@@ -1 +0,0 @@
foo

View File

@@ -1,16 +0,0 @@
package main
import "fmt"
func main() {
fmt.Println(injectBar(42))
}
type foo int
type bar int
//goose:provide
//goose:optional f
func provideBar(f foo) bar {
return bar(f)
}

View File

@@ -1,7 +0,0 @@
//+build gooseinject
package main
//goose:use provideBar
func injectBar(foo) bar

View File

@@ -1 +0,0 @@
42

View File

@@ -1 +0,0 @@
foo

View File

@@ -1,23 +0,0 @@
package main
import "fmt"
func main() {
fb := injectFooBar()
fmt.Println(fb.Foo, fb.OptionalBar)
}
type Foo int
type Bar int
//goose:provide Set
//goose:optional OptionalBar
type FooBar struct {
Foo Foo
OptionalBar Bar
}
//goose:provide Set
func provideFoo() Foo {
return 42
}

View File

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

View File

@@ -1 +0,0 @@
42 0

View File

@@ -1 +0,0 @@
foo

View File

@@ -1,28 +0,0 @@
package main
import "fmt"
func main() {
fb := injectFooBar()
fmt.Println(fb.Foo, fb.Bar)
}
type Foo int
type Bar int
//goose:provide Set
//goose:optional Bar
type FooBar struct {
Foo Foo
Bar Bar
}
//goose:provide Set
func provideFoo() Foo {
return 41
}
//goose:provide Set
func provideBar() Bar {
return 1
}

View File

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

View File

@@ -1 +0,0 @@
41 1

View File

@@ -1 +0,0 @@
foo