Commit e164f0f
committed
fix: refactor package parsing and fix command execution
**Problem:**
- Package installation failed with "invalid char ' '" errors due to improper whitespace handling
- Complex sed regex patterns were fragile and hard to maintain
- Duplicated environment setup code for go install vs go get
**Solution:**
- Simplified comment parsing using bash pattern matching for full-line comments
- Added explicit whitespace trimming with xargs after removing inline comments
- Consolidated go command execution using array for proper argument handling
- Use separate variable for package installation to avoid mutating display name
**Changes:**
- Replace complex sed patterns with simpler, more robust parsing logic
- Use bash array for go_cmd to properly handle "get -u" as separate arguments
- Add stderr redirection (2>&1) for proper error capture
- Fix typo: "donwload" -> "download"
- Consolidate duplicate GOROOT/GOPATH/PATH setup
**Impact:**
- Fixes installation failures for packages in .default-golang-pkgs
- Supports comments and various whitespace formatting in package files
- More maintainable code1 parent 50c8f58 commit e164f0f
1 file changed
+22
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
46 | | - | |
| 48 | + | |
47 | 49 | | |
| 50 | + | |
48 | 51 | | |
49 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
50 | 55 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | 56 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 57 | + | |
| 58 | + | |
63 | 59 | | |
64 | 60 | | |
65 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
| 75 | + | |
0 commit comments