Russ Cox | 8080384 | 2012-02-16 23:49:59 -0500 | [diff] [blame] | 1 | // errorcheck |
Rémy Oudompheng | 4349eff | 2011-12-07 16:18:50 -0500 | [diff] [blame] | 2 | |
Emmanuel Odeke | 53fd522 | 2016-04-10 14:32:26 -0700 | [diff] [blame] | 3 | // Copyright 2011 The Go Authors. All rights reserved. |
Rémy Oudompheng | 4349eff | 2011-12-07 16:18:50 -0500 | [diff] [blame] | 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
| 7 | // Issue 2276. |
| 8 | |
| 9 | // Check that the error messages says |
Rémy Oudompheng | 21f1769 | 2012-01-29 10:35:11 +0100 | [diff] [blame] | 10 | // bug381.go:29: unsafe.Alignof(0) not used |
Rémy Oudompheng | 4349eff | 2011-12-07 16:18:50 -0500 | [diff] [blame] | 11 | // and not |
Rémy Oudompheng | 21f1769 | 2012-01-29 10:35:11 +0100 | [diff] [blame] | 12 | // bug381.go:29: 4 not used |
| 13 | |
| 14 | // Issue 2768: previously got |
| 15 | // bug381.go:30: cannot use 3 (type time.Weekday) as type int in function argument |
| 16 | // want |
| 17 | // bug381.go:30: cannot use time.Wednesday (type time.Weekday) as type int in function argument |
Rémy Oudompheng | 4349eff | 2011-12-07 16:18:50 -0500 | [diff] [blame] | 18 | |
| 19 | package main |
| 20 | |
Rémy Oudompheng | 21f1769 | 2012-01-29 10:35:11 +0100 | [diff] [blame] | 21 | import ( |
| 22 | "time" |
| 23 | "unsafe" |
| 24 | ) |
| 25 | |
| 26 | func f(int) |
Rémy Oudompheng | 4349eff | 2011-12-07 16:18:50 -0500 | [diff] [blame] | 27 | |
| 28 | func main() { |
| 29 | unsafe.Alignof(0) // ERROR "unsafe\.Alignof|value computed is not used" |
Rémy Oudompheng | 21f1769 | 2012-01-29 10:35:11 +0100 | [diff] [blame] | 30 | f(time.Wednesday) // ERROR "time.Wednesday|incompatible type" |
Rémy Oudompheng | 4349eff | 2011-12-07 16:18:50 -0500 | [diff] [blame] | 31 | } |