Source file src/cmd/vet/testdata/errorsas/errorsas.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package errorsas
     6  
     7  import "errors"
     8  
     9  type MyError struct{}
    10  
    11  func (MyError) Error() string { return "" }
    12  
    13  func _(err error) {
    14  	var target MyError
    15  	errors.As(err, target) // ERROR "second argument to errors.As must be a non-nil pointer"
    16  }
    17  

View as plain text