You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-07-15 01:34:38 +02:00
fix(golangBuild): order of arguments (#3645)
* fix: order of go build arguments As per https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies The `go build [-o output] [build flags] [packages] ` -ldflags shall be put before packages. The build may fail this way ``` running command: go build -trimpath -o foo-linux.amd64 ./cmd/main.go -ldflags '-linkmode=external' named files must be .go files: -ldflags ```
This commit is contained in:
@ -98,6 +98,7 @@ func TestRunGolangBuild(t *testing.T) {
|
||||
config := golangBuildOptions{
|
||||
RunTests: true,
|
||||
LdflagsTemplate: "test",
|
||||
Packages: []string{"package/foo"},
|
||||
TargetArchitectures: []string{"linux,amd64"},
|
||||
}
|
||||
utils := newGolangBuildTestsUtils()
|
||||
@ -110,7 +111,7 @@ func TestRunGolangBuild(t *testing.T) {
|
||||
assert.Equal(t, "gotestsum", utils.ExecMockRunner.Calls[1].Exec)
|
||||
assert.Equal(t, []string{"--junitfile", "TEST-go.xml", "--", fmt.Sprintf("-coverprofile=%v", coverageFile), "./..."}, utils.ExecMockRunner.Calls[1].Params)
|
||||
assert.Equal(t, "go", utils.ExecMockRunner.Calls[2].Exec)
|
||||
assert.Equal(t, []string{"build", "-trimpath", "-ldflags", "test"}, utils.ExecMockRunner.Calls[2].Params)
|
||||
assert.Equal(t, []string{"build", "-trimpath", "-ldflags", "test", "package/foo"}, utils.ExecMockRunner.Calls[2].Params)
|
||||
})
|
||||
|
||||
t.Run("success - tests with coverage", func(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user