Skip to content

Commit

Permalink
examples: add "ExampleLabelsGoFunc"
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
  • Loading branch information
gyuho committed Jun 13, 2018
1 parent 0a715f5 commit 4181321
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
16 changes: 15 additions & 1 deletion examples/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,23 @@ import (
"github.com/coreos/gofail/examples"
)

/*
GOFAIL_HTTP=:22381 go run cmd.go
curl -L http://localhost:22381
curl \
-L http://localhost:22381/github.com/coreos/gofail/examples/ExampleLabelsGo \
-X PUT -d'return'
curl \
-L http://localhost:22381/github.com/coreos/gofail/examples/ExampleLabelsGo \
-X DELETE
*/

func main() {
for {
log.Println(examples.ExampleFunc())
log.Println(examples.ExampleLabelsGoFunc())
time.Sleep(time.Second)
}
}
15 changes: 15 additions & 0 deletions examples/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,18 @@ func ExampleLabelsFunc() (s string) {
}
return s
}

func ExampleLabelsGoFunc() (s string) {
i := 0
// gofail: myLabel:
for i < 5 {
s = s + "i"
i++
for j := 0; j < 5; j++ {
s = s + "j"
// gofail-go: var ExampleLabelsGo struct{}
// continue myLabel
}
}
return s
}

0 comments on commit 4181321

Please sign in to comment.