Russ Cox | 2b1c9b4 | 2012-02-16 23:49:30 -0500 | [diff] [blame] | 1 | // errorcheck |
Rob Pike | 3308eb4 | 2008-08-20 15:46:05 -0700 | [diff] [blame] | 2 | |
| 3 | // Copyright 2009 The Go Authors. All rights reserved. |
| 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
| 7 | package main |
| 8 | |
| 9 | func f1() { |
Russ Cox | e72156b | 2011-03-15 14:05:07 -0400 | [diff] [blame] | 10 | exit: |
| 11 | print("hi\n") |
| 12 | goto exit |
Rob Pike | 3308eb4 | 2008-08-20 15:46:05 -0700 | [diff] [blame] | 13 | } |
| 14 | |
| 15 | func f2() { |
Russ Cox | e72156b | 2011-03-15 14:05:07 -0400 | [diff] [blame] | 16 | const c = 1234 |
Rob Pike | 3308eb4 | 2008-08-20 15:46:05 -0700 | [diff] [blame] | 17 | } |
| 18 | |
| 19 | func f3() { |
Russ Cox | e72156b | 2011-03-15 14:05:07 -0400 | [diff] [blame] | 20 | i := c // ERROR "undef" |
Rob Pike | 3308eb4 | 2008-08-20 15:46:05 -0700 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | func main() { |
Russ Cox | e72156b | 2011-03-15 14:05:07 -0400 | [diff] [blame] | 24 | f3() |
Rob Pike | 3308eb4 | 2008-08-20 15:46:05 -0700 | [diff] [blame] | 25 | } |