setGoDebug is an escape hatch that sets the GODEBUG environment variable value using docker context metadata. { "Name": "my-context", "Metadata": { "GODEBUG": "x509negativeserial=1" } } WARNING: Setting x509negativeserial=1 allows Go's x509 library to accept X.509 certificates with negativ
(meta store.Metadata)
| 492 | // production environments. |
| 493 | // Use at your own risk. |
| 494 | func setGoDebug(meta store.Metadata) { |
| 495 | fieldName := "GODEBUG" |
| 496 | godebugEnv := os.Getenv(fieldName) |
| 497 | // early return if GODEBUG is already set. We don't want to override what |
| 498 | // the user already sets. |
| 499 | if godebugEnv != "" { |
| 500 | return |
| 501 | } |
| 502 | |
| 503 | var cfg any |
| 504 | var ok bool |
| 505 | switch m := meta.Metadata.(type) { |
| 506 | case DockerContext: |
| 507 | cfg, ok = m.AdditionalFields[fieldName] |
| 508 | if !ok { |
| 509 | return |
| 510 | } |
| 511 | case map[string]any: |
| 512 | cfg, ok = m[fieldName] |
| 513 | if !ok { |
| 514 | return |
| 515 | } |
| 516 | default: |
| 517 | return |
| 518 | } |
| 519 | |
| 520 | v, ok := cfg.(string) |
| 521 | if !ok { |
| 522 | return |
| 523 | } |
| 524 | // set the GODEBUG environment variable with whatever was in the context |
| 525 | _ = os.Setenv(fieldName, v) |
| 526 | } |
| 527 | |
| 528 | func (cli *DockerCli) initialize() error { |
| 529 | cli.init.Do(func() { |
no outgoing calls
searching dependent graphs…