github.com/hikaru7719/go@v0.0.0-20181025140707-c8b2ac68906a/test/fixedbugs/issue27595.go (about)

     1  // errorcheck
     2  
     3  // Copyright 2018 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  var a = twoResults()       // ERROR "assignment mismatch: 1 variable but twoResults returns 2 values"
    10  var b, c, d = twoResults() // ERROR "assignment mismatch: 3 variables but twoResults returns 2 values"
    11  var e, f = oneResult()     // ERROR "assignment mismatch: 2 variables but oneResult returns 1 values"
    12  
    13  func twoResults() (int, int) {
    14  	return 1, 2
    15  }
    16  
    17  func oneResult() int {
    18  	return 1
    19  }