...
Run Format

Source file test/fixedbugs/issue14646.go

Documentation: test/fixedbugs

     1  // run
     2  
     3  // Copyright 2016 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  import "runtime"
    10  
    11  func main() {
    12  	var file string
    13  	var line int
    14  	func() {
    15  		defer func() {
    16  			_, file, line, _ = runtime.Caller(1)
    17  		}()
    18  	}() // this is the expected line
    19  	const EXPECTED = 18
    20  	if line != EXPECTED {
    21  		println("Expected line =", EXPECTED, "but got line =", line, "and file =", file)
    22  	}
    23  }
    24  

View as plain text