Skip to content

Commit aa3b3e4

Browse files
authored
feat: Allow to include symbols in binaries during package (#1974)
#### Summary Without the symbols it's hard to validate we're generating FIPS compliant binaries (see cloudquery/cloudquery-issues#2586 and https://github.com/cloudquery/cloudquery/pull/19676/files#diff-3613eb0da60aba72ff182962b6ae3a738e42369d8bed0407cba78ba7cc72f052R101). --- Use the following steps to ensure your PR is ready to be reviewed - [ ] Read the [contribution guidelines](../blob/main/CONTRIBUTING.md) 🧑‍🎓 - [ ] Run `go fmt` to format your code 🖊 - [ ] Lint your changes via `golangci-lint run` 🚨 (install golangci-lint [here](https://golangci-lint.run/usage/install/#local-installation)) - [ ] Update or add tests 🧪 - [ ] Ensure the status checks below are successful ✅
1 parent 7076899 commit aa3b3e4

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

plugin/plugin_package.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ const (
3737
)
3838

3939
type BuildTarget struct {
40-
OS string `json:"os"`
41-
Arch string `json:"arch"`
42-
CGO bool `json:"cgo"`
43-
Env []string `json:"env"`
40+
OS string `json:"os"`
41+
Arch string `json:"arch"`
42+
CGO bool `json:"cgo"`
43+
Env []string `json:"env"`
44+
IncludeSymbols bool `json:"include_symbols"`
4445
}
4546

4647
func (t BuildTarget) EnvVariables() []string {

serve/package.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ func (s *PluginServe) build(pluginDirectory string, target plugin.BuildTarget, d
124124
if err != nil {
125125
return nil, err
126126
}
127-
ldFlags := fmt.Sprintf("-s -w -X %[1]s/plugin.Version=%[2]s -X %[1]s/resources/plugin.Version=%[2]s", importPath, pluginVersion)
127+
stripSymbols := "-s "
128+
if target.IncludeSymbols {
129+
stripSymbols = ""
130+
}
131+
ldFlags := fmt.Sprintf("%[1]s -w -X %[2]s/plugin.Version=%[3]s -X %[2]s/resources/plugin.Version=%[2]s", stripSymbols, importPath, pluginVersion)
128132
args := []string{"build", "-o", pluginPath}
129133
args = append(args, "-buildmode=exe")
130134
args = append(args, "-ldflags", ldFlags)

0 commit comments

Comments
 (0)