Skip to content

Omit unset fields

Coming soon

See the mszostok/version#12 issue for reference. If you'd like to see it included in a future release, add 👍 under the issue.

Examples

  • Explicitly exclude a given set of version fields:

    // excludedFields defines preset for fields that should be excluded in output.
    const excludedFields = printer.FieldCompiler | printer.FieldPlatform
    
    p := printer.New(printer.WithExcludedFields(excludedFields))
    if err := p.Print(os.Stdout); err != nil {
      log.Fatal(err)
    }
    
  • Don't display empty("") and unset(N/A) version fields:

    p := printer.New(printer.WithOmitUnset(excludedFields))
    if err := p.Print(os.Stdout); err != nil {
      log.Fatal(err)
    }
    
Back to top