Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spell mixins for Go toolchain options #37

Closed
svengreb opened this issue Nov 24, 2020 · 0 comments Β· Fixed by #38
Closed

Spell mixins for Go toolchain options #37

svengreb opened this issue Nov 24, 2020 · 0 comments Β· Fixed by #38

Comments

@svengreb
Copy link
Owner

svengreb commented Nov 24, 2020

To support common use cases for debugging and production optimization, some spell mixins will be implemented in the golang package:

  • πŸ†‚ MixinImproveDebugging β€” A struct type that adds linker flags to improve the debugging of binary artifacts. This includes the disabling of inlining and all compiler optimizations tp improve the compatibility for debuggers.
    Note that this mixin will add the all prefix for β€”gcflags parameters to make sure all packages are affected. If you disabled the all prefix on purpose you need to handle this conflict on your own, e.g. by creating more than one binary artifact each with different build options.
  • πŸ†‚ MixinImproveEscapeAnalysis β€” A struct type that will add linker flags to improve the escape analysis of binary artifacts.
    Note that this mixin removes the all prefix for β€”gcflags parameters to make sure only the target package is affected, otherwise reports for (traverse) dependencies would be included as well. If you enabled the all prefix on purpose you need to handle this conflict on your own, e.g. by creating more than one binary artifact each with different build options.
  • πŸ†‚ MixinStripDebugMetadata β€” A struct type that will add linker flags to strip debug information from binary artifacts. This will include DWARF tables needed for debuggers, but keeps annotations needed for stack traces so panics are still readable. It will also shrink the file size and memory overhead as well as reducing the chance for possible security related problems due to enabled development features or debug information leaks.
    Note that this mixin will add the all prefix for β€”gcflags parameters to make sure all packages are affected. If you disabled the all prefix on purpose you need to handle this conflict on your own, e.g. by creating more than one binary artifact each with different build options.
  • πŸ†‚ MixinInjectBuildTimeVariableValues β€” A struct type that will inject buildβ€”time values through the β€”X linker flags to populate e.g. application metadata variables.
    It will store a map[string]string of key/value pairs to inject to variables at buildβ€”time. The key must be the path to the variable in form of <IMPORT_PATH>.<VARIABLE_NAME>, e.g. pkg/internal/support/app.version. The value is the actual value that will be assigned to the variable, e.g. the application version.
    A field of type *project.GoModuleID will store partial information about the target Go module to inject the key/value pairs from the data map into.
@svengreb svengreb added this to the 0.1.0 milestone Nov 24, 2020
@svengreb svengreb self-assigned this Nov 24, 2020
svengreb added a commit that referenced this issue Nov 24, 2020
To support common use cases for debugging and production optimization,
some spell mixins [1] have been implemented in the "golang" [2]
package:

- πŸ†‚ `MixinImproveDebugging` - A `struct` type that adds linker flags to
  improve the debugging of binary artifacts. This includes the disabling
  of inlining and all compiler optimizations tp improve the
  compatibility for debuggers.
  Note that this mixin adds the `all` prefix for `-gcflags` parameters
  to make sure all packages are affected. If you disabled the `all`
  prefix on purpose you need to handle this conflict on your own, e.g.
  by creating more than one binary artifact each with different build
  options.
- πŸ†‚ `MixinImproveEscapeAnalysis` - A `struct` type that adds linker
  flags to improve the escape analysis of binary artifacts.
  Note that this mixin removes the `all` prefix for `-gcflags`
  parameters to make sure only the target package is affected, otherwise
  reports for (traverse) dependencies would be included as well.
  If you enabled the `all` prefix on purpose you need to handle this
  conflict on your own, e.g. by creating more than one binary artifact
  each with different build options.
- πŸ†‚ `MixinStripDebugMetadata` - A `struct` type that adds linker flags
  to strip debug information from binary artifacts. This includes
  "DWARF" tables needed for debuggers, but keeps annotations needed for
  stack traces so panics are still readable. It also shrinks the
  file size and memory overhead as well as reducing the chance for
  possible security related problems due to enabled development features
  or debug information leaks.
  Note that this mixin adds the `all` prefix for `-gcflags` parameters
  to make sure all packages are affected. If you disabled the `all`
  prefix on purpose you need to handle this conflict on your own, e.g.
  by creating more than one binary artifact each with different build
  options.
- πŸ†‚ `MixinInjectBuildTimeVariableValues` - A `struct` type that injects
  build-time values through the `-X` linker flags to populate e.g.
  application metadata variables.
  It store a `map[string]string` of key/value pairs to inject to
  variables at build-time. The key must be the path to the variable in
  form of `<IMPORT_PATH>.<VARIABLE_NAME>`, e.g.
  `pkg/internal/support/app.version`. The value is the actual value that
  will be assigned to the variable, e.g. the application version.
  A field of type `*project.GoModuleID` [3] stores partial information
  about the target Go module to inject the key/value pairs from the data
  map into.

[1]: https://pkg.go.dev/github.com/svengreb/wand/pkg/spell#Mixin
[2]: https://pkg.go.dev/github.com/svengreb/wand/pkg/spell/golang
[3]: https://pkg.go.dev/github.com/svengreb/wand/pkg/project#GoModuleID

GH-37
@svengreb svengreb removed the scope-dx label Nov 24, 2020
svengreb added a commit that referenced this issue Nov 24, 2020
To support common use cases for debugging and production optimization,
some spell mixins [1] have been implemented in the "golang" [2]
package:

- πŸ†‚ `MixinImproveDebugging` - A `struct` type that adds linker flags to
  improve the debugging of binary artifacts. This includes the disabling
  of inlining and all compiler optimizations tp improve the
  compatibility for debuggers.
  Note that this mixin adds the `all` prefix for `-gcflags` parameters
  to make sure all packages are affected. If you disabled the `all`
  prefix on purpose you need to handle this conflict on your own, e.g.
  by creating more than one binary artifact each with different build
  options.
- πŸ†‚ `MixinImproveEscapeAnalysis` - A `struct` type that adds linker
  flags to improve the escape analysis of binary artifacts.
  Note that this mixin removes the `all` prefix for `-gcflags`
  parameters to make sure only the target package is affected, otherwise
  reports for (traverse) dependencies would be included as well.
  If you enabled the `all` prefix on purpose you need to handle this
  conflict on your own, e.g. by creating more than one binary artifact
  each with different build options.
- πŸ†‚ `MixinStripDebugMetadata` - A `struct` type that adds linker flags
  to strip debug information from binary artifacts. This includes
  "DWARF" tables needed for debuggers, but keeps annotations needed for
  stack traces so panics are still readable. It also shrinks the
  file size and memory overhead as well as reducing the chance for
  possible security related problems due to enabled development features
  or debug information leaks.
  Note that this mixin adds the `all` prefix for `-gcflags` parameters
  to make sure all packages are affected. If you disabled the `all`
  prefix on purpose you need to handle this conflict on your own, e.g.
  by creating more than one binary artifact each with different build
  options.
- πŸ†‚ `MixinInjectBuildTimeVariableValues` - A `struct` type that injects
  build-time values through the `-X` linker flags to populate e.g.
  application metadata variables.
  It store a `map[string]string` of key/value pairs to inject to
  variables at build-time. The key must be the path to the variable in
  form of `<IMPORT_PATH>.<VARIABLE_NAME>`, e.g.
  `pkg/internal/support/app.version`. The value is the actual value that
  will be assigned to the variable, e.g. the application version.
  A field of type `*project.GoModuleID` [3] stores partial information
  about the target Go module to inject the key/value pairs from the data
  map into.

[1]: https://pkg.go.dev/github.com/svengreb/wand/pkg/spell#Mixin
[2]: https://pkg.go.dev/github.com/svengreb/wand/pkg/spell/golang
[3]: https://pkg.go.dev/github.com/svengreb/wand/pkg/project#GoModuleID

Closes GH-37
@svengreb svengreb removed their assignment Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant