mirrord: Go programs cannot access environment variables

Bug Description

Go binaries cannot access environment variables.

Steps to Reproduce

// main.go
package main

import (
	"fmt"
	"os"
)

func main() {
	fmt.Println(os.Environ())
}
go build main.go
mirrord exec \
        --pod-namespace some-namespace \
        --pod-name some-pod \
        --override-env-vars-include "*" \
        ./main

Compare with

mirrord exec \
        --pod-namespace some-namespace \
        --pod-name some-pod \
        --override-env-vars-include "*" \
        env

Backtrace

No response

Relevant Logs

No response

Your operating system and version

macOS 12.5.1 Monterey

Local process

main: Mach-O 64-bit executable x86_64 go version go1.19 darwin/amd64

Local process version

No response

Additional Info

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (12 by maintainers)

Commits related to this issue

Most upvoted comments

It works! Awesome work @aviramha. Closing.

Thanks for the awesome work! I look forward to see your solution.

Thanks for reporting this so detailed and informative. We’ll look into that and deliver a fix ASAP 😃 P.S - Env vars feature doesn’t rely on hooks - we just modify the env on init