Last active
September 22, 2015 20:57
-
-
Save infogulch/cb67ad61a2b06741768f to your computer and use it in GitHub Desktop.
Test file for /clipperhouse/gen/pull/65
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// +gen | |
type Thing int | |
func main() { | |
x := Things{2,1,3} | |
x = x.Sort() | |
x = x.Where(func(t Thing) bool { return true }) | |
x = x.SortDesc() | |
min, _ := x.Min() | |
// x.Each(func(t Thing) { return }) | |
println(min) | |
} | |
/* | |
Steps: | |
* Write the contents of this file to `main.go`. | |
* Run `gen`. It should complain about 'Things' being undefined, but continue | |
anyway and write `thing_gen.go` with *all* methods defined. | |
* Run `gen` again, twice. Now `thing_gen.go` should only include the methods | |
used in this file. | |
Simulating maintenance: | |
* Uncomment the Each line and run `gen` again. It will complain about Each not | |
being defined, but it should generate the templates just fine. | |
* Comment the Each line out again and run `gen`. The definition of Each should | |
dissapear from `thing_gen.go`. | |
The source should build successfully with `go build` just after running `gen` | |
for all the steps above. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment