Source file test/fixedbugs/issue48033.go

     1  // compile
     2  
     3  // Copyright 2021 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 (
    10  	"fmt"
    11  	"strings"
    12  )
    13  
    14  type app struct {
    15  	Name string
    16  }
    17  
    18  func bug() func() {
    19  	return func() {
    20  
    21  		// the issue is this if true block
    22  		if true {
    23  			return
    24  		}
    25  
    26  		var xx = []app{}
    27  		var gapp app
    28  		for _, app := range xx {
    29  			if strings.ToUpper("") == app.Name {
    30  				fmt.Printf("%v\n", app)
    31  				gapp = app
    32  			}
    33  		}
    34  		fmt.Println(gapp)
    35  	}
    36  }
    37  
    38  func main() {
    39  	bug()
    40  }
    41  

View as plain text