Skip to content

Commit

Permalink
feat: pass environment to go compiler
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Stewart <[email protected]>
  • Loading branch information
paralin committed Apr 10, 2024
1 parent 624b44a commit 2248f99
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/goweight.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package pkg

import (
"io/ioutil"
"log"
"os"
"os/exec"
Expand All @@ -17,7 +16,9 @@ import (
var moduleRegex = regexp.MustCompile("packagefile (.*)=(.*)")

func run(cmd []string) string {
out, err := exec.Command(cmd[0], cmd[1:]...).CombinedOutput()
c := exec.Command(cmd[0], cmd[1:]...)
c.Env = append([]string{}, os.Environ()...)
out, err := c.CombinedOutput()
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -71,7 +72,7 @@ func (g *GoWeight) Process(work string) []*ModuleEntry {
}

allLines := funk.Uniq(funk.FlattenDeep(funk.Map(files, func(file string) []string {
f, err := ioutil.ReadFile(file)
f, err := os.ReadFile(file)
if err != nil {
return []string{}
}
Expand Down

0 comments on commit 2248f99

Please sign in to comment.