Source file test/inline_variadic.go

     1  // errorcheck -0 -m
     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  // Test inlining of variadic functions.
     8  // See issue #18116.
     9  
    10  package foo
    11  
    12  func head(xs ...string) string { // ERROR "can inline head" "leaking param: xs to result"
    13  	return xs[0]
    14  }
    15  
    16  func f() string { // ERROR "can inline f"
    17  	x := head("hello", "world") // ERROR "inlining call to head" "\.\.\. argument does not escape"
    18  	return x
    19  }
    20  

View as plain text