X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fcoc-go-data%2Ftools%2Fpkg%2Fmod%2Fgolang.org%2Fx%2Ftools%40v0.0.0-20201105173854-bc9fc8d8c4bc%2Fgo%2Fanalysis%2Fpasses%2Ferrorsas%2Ftestdata%2Fsrc%2Fa%2Fa.go;fp=.config%2Fcoc%2Fextensions%2Fcoc-go-data%2Ftools%2Fpkg%2Fmod%2Fgolang.org%2Fx%2Ftools%40v0.0.0-20201105173854-bc9fc8d8c4bc%2Fgo%2Fanalysis%2Fpasses%2Ferrorsas%2Ftestdata%2Fsrc%2Fa%2Fa.go;h=c987a8a6508956e3833cf168319f4d7ab015a351;hb=4d07c77cf4d78cab8639e13ddc3c22495e585b0b;hp=0000000000000000000000000000000000000000;hpb=b3950616b54221c40a7dab9099bda675007e5b6e;p=dotfiles%2F.git diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201105173854-bc9fc8d8c4bc/go/analysis/passes/errorsas/testdata/src/a/a.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201105173854-bc9fc8d8c4bc/go/analysis/passes/errorsas/testdata/src/a/a.go new file mode 100644 index 00000000..c987a8a6 --- /dev/null +++ b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201105173854-bc9fc8d8c4bc/go/analysis/passes/errorsas/testdata/src/a/a.go @@ -0,0 +1,43 @@ +// Copyright 2019 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. + +// This file contains tests for the errorsas checker. + +package a + +import "errors" + +type myError int + +func (myError) Error() string { return "" } + +func perr() *error { return nil } + +type iface interface { + m() +} + +func two() (error, interface{}) { return nil, nil } + +func _() { + var ( + e error + m myError + i int + f iface + ei interface{} + ) + errors.As(nil, &e) // *error + errors.As(nil, &m) // *T where T implemements error + errors.As(nil, &f) // *interface + errors.As(nil, perr()) // *error, via a call + errors.As(nil, ei) // empty interface + + errors.As(nil, nil) // want `second argument to errors.As must be a non-nil pointer to either a type that implements error, or to any interface type` + errors.As(nil, e) // want `second argument to errors.As must be a non-nil pointer to either a type that implements error, or to any interface type` + errors.As(nil, m) // want `second argument to errors.As must be a non-nil pointer to either a type that implements error, or to any interface type` + errors.As(nil, f) // want `second argument to errors.As must be a non-nil pointer to either a type that implements error, or to any interface type` + errors.As(nil, &i) // want `second argument to errors.As must be a non-nil pointer to either a type that implements error, or to any interface type` + errors.As(two()) +}