Skip to content

Commit

Permalink
inject github.com/cpunion/go-python.ProjectRoot variable
Browse files Browse the repository at this point in the history
  • Loading branch information
cpunion committed Nov 20, 2024
1 parent 7f748b3 commit 7c4d1df
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions inject.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package gp

import (
"fmt"
"os"

"github.com/cpunion/go-python/internal/env"
)

var ProjectRoot string

func init() {
if ProjectRoot == "" {
fmt.Fprintf(os.Stderr, "ProjectRoot is not set\n")
return
}
envs, err := env.ReadEnv(ProjectRoot)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to read env: %s\n", err)
return
}
for key, value := range envs {
os.Setenv(key, value)
}

Check warning on line 24 in inject.go

View check run for this annotation

Codecov / codecov/patch

inject.go#L17-L24

Added lines #L17 - L24 were not covered by tests
}

0 comments on commit 7c4d1df

Please sign in to comment.