github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/ssa/testdata/structconv.go (about)

     1  //+build ignore
     2  
     3  // This file is the input to TestValueForExprStructConv in identical_test.go,
     4  // which uses the same framework as TestValueForExpr does in source_test.go.
     5  //
     6  // In Go 1.8, struct conversions are permitted even when the struct types have
     7  // different tags. This wasn't permitted in earlier versions of Go, so this file
     8  // exists separately from valueforexpr.go to just test this behavior in Go 1.8
     9  // and later.
    10  
    11  package main
    12  
    13  type t1 struct {
    14  	x int
    15  }
    16  type t2 struct {
    17  	x int `tag`
    18  }
    19  
    20  func main() {
    21  	var tv1 t1
    22  	var tv2 t2 = /*@ChangeType*/ (t2(tv1))
    23  	_ = tv2
    24  }