mirror of
https://github.com/golang/go
synced 2024-11-18 02:44:48 -07:00
08918ba438
Used to say: issue4251.go:12: inverted slice range issue4251.go:12: constant -1 overflows uint64 issue4251.go:16: inverted slice range issue4251.go:16: constant -1 overflows uint64 issue4251.go:20: inverted slice range issue4251.go:20: constant -1 overflows uint64 With this patch, only gives the "inverted slice range" errors. R=golang-dev, daniel.morsing CC=golang-dev https://golang.org/cl/6871058
22 lines
441 B
Go
22 lines
441 B
Go
// errorcheck
|
|
|
|
// Copyright 2012 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Issue 4251: slice with inverted range is an error.
|
|
|
|
package p
|
|
|
|
func F1(s []byte) []byte {
|
|
return s[2:1] // ERROR "inverted"
|
|
}
|
|
|
|
func F2(a [10]byte) []byte {
|
|
return a[2:1] // ERROR "inverted"
|
|
}
|
|
|
|
func F3(s string) string {
|
|
return s[2:1] // ERROR "inverted"
|
|
}
|