github.com/huandu/go@v0.0.0-20151114150818-04e615e41150/misc/cgo/testgodefs/test.bash (about)

     1  #!/usr/bin/env bash
     2  
     3  # Copyright 2014 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  # We are testing cgo -godefs, which translates Go files that use
     8  # import "C" into Go files with Go definitions of types defined in the
     9  # import "C" block.  Add more tests here.
    10  FILE_PREFIXES="anonunion issue8478"
    11  
    12  RM=
    13  for FP in $FILE_PREFIXES
    14  do
    15    go tool cgo -godefs ${FP}.go > ${FP}_defs.go
    16    RM="${RM} ${FP}_defs.go"
    17  done
    18  
    19  go build . && ./testgodefs
    20  EXIT=$?
    21  rm -rf _obj testgodefs ${RM}
    22  exit $EXIT