| 1 |
// Copyright 2016 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package main |
| 6 |
|
| 7 |
// int the_answer(); |
| 8 |
import "C" |
| 9 |
import ( |
| 10 |
"fmt" |
| 11 |
"os" |
| 12 |
) |
| 13 |
|
| 14 |
func TheAnswer() int { |
| 15 |
return int(C.the_answer()) |
| 16 |
} |
| 17 |
|
| 18 |
func main() { |
| 19 |
if a := TheAnswer(); a != 42 { |
| 20 |
fmt.Fprintln(os.Stderr, "Unexpected result for The Answer. Got:", a, " Want: 42") |
| 21 |
os.Exit(1) |
| 22 |
} |
| 23 |
fmt.Fprintln(os.Stdout, "ok") |
| 24 |
} |