github.com/likebike/go--@v0.0.0-20190911215757-0bd925d16e96/go/test/fixedbugs/issue10607.go (about)

     1  // +build linux,!ppc64
     2  // run
     3  
     4  // Copyright 2015 The Go Authors. All rights reserved.
     5  // Use of this source code is governed by a BSD-style
     6  // license that can be found in the LICENSE file.
     7  
     8  // Test that a -B option is passed through when using both internal
     9  // and external linking mode.
    10  
    11  package main
    12  
    13  import (
    14  	"fmt"
    15  	"os"
    16  	"os/exec"
    17  	"path/filepath"
    18  )
    19  
    20  func main() {
    21  	test("internal")
    22  	test("external")
    23  }
    24  
    25  func test(linkmode string) {
    26  	out, err := exec.Command("go", "run", "-ldflags", "-B=0x12345678 -linkmode="+linkmode, filepath.Join("fixedbugs", "issue10607a.go")).CombinedOutput()
    27  	if err != nil {
    28  		fmt.Printf("BUG: linkmode=%s %v\n%s\n", linkmode, err, out)
    29  		os.Exit(1)
    30  	}
    31  }