mirror of
https://github.com/DeBrosOfficial/network.git
synced 2025-12-12 22:58:49 +00:00
feat: enhance Go module cache setup in CLI
- Added Go module cache directory to the setupDirectories function for improved Go environment configuration. - Updated cloneAndBuild function to set HOME environment variable, ensuring proper module cache creation during build process.
This commit is contained in:
parent
2aead48045
commit
c5d3dd1f6d
@ -680,6 +680,7 @@ func setupDirectories() {
|
||||
"/home/debros/bin",
|
||||
"/home/debros/src",
|
||||
"/home/debros/.debros",
|
||||
"/home/debros/go", // Go module cache directory
|
||||
}
|
||||
|
||||
for _, dir := range dirs {
|
||||
@ -743,8 +744,10 @@ func cloneAndBuild() {
|
||||
os.Setenv("PATH", os.Getenv("PATH")+":/usr/local/go/bin")
|
||||
|
||||
// Use sudo with --preserve-env=PATH to pass Go path to debros user
|
||||
// Set HOME so Go knows where to create module cache
|
||||
cmd := exec.Command("sudo", "--preserve-env=PATH", "-u", "debros", "make", "build")
|
||||
cmd.Dir = "/home/debros/src"
|
||||
cmd.Env = append(os.Environ(), "HOME=/home/debros", "PATH="+os.Getenv("PATH")+":/usr/local/go/bin")
|
||||
if output, err := cmd.CombinedOutput(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "❌ Failed to build: %v\n%s\n", err, output)
|
||||
os.Exit(1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user