@fredlackey/devutils 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/README.md +32 -150
  2. package/package.json +5 -82
  3. package/bin/dev.js +0 -16
  4. package/files/README.md +0 -0
  5. package/files/claude/.claude/commands/setup-context.md +0 -3
  6. package/files/monorepos/_archive/README.md +0 -36
  7. package/files/monorepos/_legacy/README.md +0 -36
  8. package/files/monorepos/ai-docs/README.md +0 -33
  9. package/files/monorepos/apps/README.md +0 -24
  10. package/files/monorepos/docs/README.md +0 -40
  11. package/files/monorepos/packages/README.md +0 -25
  12. package/files/monorepos/research/README.md +0 -29
  13. package/files/monorepos/scripts/README.md +0 -24
  14. package/src/cli.js +0 -72
  15. package/src/commands/README.md +0 -41
  16. package/src/commands/configure.js +0 -199
  17. package/src/commands/identity.js +0 -1630
  18. package/src/commands/ignore.js +0 -247
  19. package/src/commands/install.js +0 -526
  20. package/src/commands/setup.js +0 -246
  21. package/src/commands/status.js +0 -223
  22. package/src/commands/update.js +0 -142
  23. package/src/commands/version.js +0 -100
  24. package/src/completion.js +0 -284
  25. package/src/constants.js +0 -45
  26. package/src/ignore/claude-code.txt +0 -10
  27. package/src/ignore/docker.txt +0 -18
  28. package/src/ignore/linux.txt +0 -23
  29. package/src/ignore/macos.txt +0 -36
  30. package/src/ignore/node.txt +0 -55
  31. package/src/ignore/terraform.txt +0 -37
  32. package/src/ignore/vscode.txt +0 -18
  33. package/src/ignore/windows.txt +0 -35
  34. package/src/index.js +0 -0
  35. package/src/installs/README.md +0 -399
  36. package/src/installs/adobe-creative-cloud.js +0 -546
  37. package/src/installs/adobe-creative-cloud.md +0 -605
  38. package/src/installs/appcleaner.js +0 -321
  39. package/src/installs/appcleaner.md +0 -699
  40. package/src/installs/apt-transport-https.js +0 -390
  41. package/src/installs/apt-transport-https.md +0 -678
  42. package/src/installs/atomicparsley.js +0 -642
  43. package/src/installs/atomicparsley.md +0 -795
  44. package/src/installs/aws-cli.js +0 -797
  45. package/src/installs/aws-cli.md +0 -727
  46. package/src/installs/balena-etcher.js +0 -710
  47. package/src/installs/balena-etcher.md +0 -761
  48. package/src/installs/bambu-studio.js +0 -1143
  49. package/src/installs/bambu-studio.md +0 -780
  50. package/src/installs/bash-completion.js +0 -575
  51. package/src/installs/bash-completion.md +0 -833
  52. package/src/installs/bash.js +0 -417
  53. package/src/installs/bash.md +0 -993
  54. package/src/installs/beyond-compare.js +0 -603
  55. package/src/installs/beyond-compare.md +0 -813
  56. package/src/installs/brave-browser.js +0 -968
  57. package/src/installs/brave-browser.md +0 -650
  58. package/src/installs/build-essential.js +0 -529
  59. package/src/installs/build-essential.md +0 -977
  60. package/src/installs/ca-certificates.js +0 -618
  61. package/src/installs/ca-certificates.md +0 -937
  62. package/src/installs/caffeine.js +0 -508
  63. package/src/installs/caffeine.md +0 -839
  64. package/src/installs/camtasia.js +0 -596
  65. package/src/installs/camtasia.md +0 -762
  66. package/src/installs/chatgpt.js +0 -476
  67. package/src/installs/chatgpt.md +0 -814
  68. package/src/installs/chocolatey.js +0 -456
  69. package/src/installs/chocolatey.md +0 -661
  70. package/src/installs/chrome-canary.js +0 -419
  71. package/src/installs/chrome-canary.md +0 -641
  72. package/src/installs/chromium.js +0 -667
  73. package/src/installs/chromium.md +0 -838
  74. package/src/installs/claude-code.js +0 -576
  75. package/src/installs/claude-code.md +0 -1173
  76. package/src/installs/cloudflare-warp.js +0 -900
  77. package/src/installs/cloudflare-warp.md +0 -1047
  78. package/src/installs/comet-browser.js +0 -588
  79. package/src/installs/comet-browser.md +0 -731
  80. package/src/installs/curl.js +0 -379
  81. package/src/installs/curl.md +0 -714
  82. package/src/installs/cursor.js +0 -579
  83. package/src/installs/cursor.md +0 -970
  84. package/src/installs/dbeaver.js +0 -924
  85. package/src/installs/dbeaver.md +0 -939
  86. package/src/installs/dbschema.js +0 -692
  87. package/src/installs/dbschema.md +0 -925
  88. package/src/installs/dependencies.md +0 -453
  89. package/src/installs/development-tools.js +0 -600
  90. package/src/installs/development-tools.md +0 -977
  91. package/src/installs/docker.js +0 -1029
  92. package/src/installs/docker.md +0 -1109
  93. package/src/installs/drawio.js +0 -1019
  94. package/src/installs/drawio.md +0 -795
  95. package/src/installs/elmedia-player.js +0 -347
  96. package/src/installs/elmedia-player.md +0 -556
  97. package/src/installs/ffmpeg.js +0 -889
  98. package/src/installs/ffmpeg.md +0 -852
  99. package/src/installs/file.js +0 -464
  100. package/src/installs/file.md +0 -987
  101. package/src/installs/gemini-cli.js +0 -811
  102. package/src/installs/gemini-cli.md +0 -1153
  103. package/src/installs/git.js +0 -400
  104. package/src/installs/git.md +0 -907
  105. package/src/installs/gitego.js +0 -949
  106. package/src/installs/gitego.md +0 -1172
  107. package/src/installs/go.js +0 -931
  108. package/src/installs/go.md +0 -958
  109. package/src/installs/google-antigravity.js +0 -913
  110. package/src/installs/google-antigravity.md +0 -1075
  111. package/src/installs/google-chrome.js +0 -833
  112. package/src/installs/google-chrome.md +0 -862
  113. package/src/installs/gpg.js +0 -480
  114. package/src/installs/gpg.md +0 -1056
  115. package/src/installs/homebrew.js +0 -1028
  116. package/src/installs/homebrew.md +0 -988
  117. package/src/installs/imageoptim.js +0 -968
  118. package/src/installs/imageoptim.md +0 -1119
  119. package/src/installs/installers.json +0 -4032
  120. package/src/installs/installers.json.tmp +0 -3953
  121. package/src/installs/jq.js +0 -400
  122. package/src/installs/jq.md +0 -809
  123. package/src/installs/keyboard-maestro.js +0 -719
  124. package/src/installs/keyboard-maestro.md +0 -825
  125. package/src/installs/kiro.js +0 -864
  126. package/src/installs/kiro.md +0 -1015
  127. package/src/installs/latex.js +0 -789
  128. package/src/installs/latex.md +0 -1095
  129. package/src/installs/lftp.js +0 -356
  130. package/src/installs/lftp.md +0 -907
  131. package/src/installs/lsb-release.js +0 -346
  132. package/src/installs/lsb-release.md +0 -814
  133. package/src/installs/messenger.js +0 -847
  134. package/src/installs/messenger.md +0 -900
  135. package/src/installs/microsoft-office.js +0 -568
  136. package/src/installs/microsoft-office.md +0 -760
  137. package/src/installs/microsoft-teams.js +0 -801
  138. package/src/installs/microsoft-teams.md +0 -886
  139. package/src/installs/moom.js +0 -326
  140. package/src/installs/moom.md +0 -570
  141. package/src/installs/node.js +0 -904
  142. package/src/installs/node.md +0 -1153
  143. package/src/installs/nordpass.js +0 -716
  144. package/src/installs/nordpass.md +0 -921
  145. package/src/installs/nordvpn.js +0 -892
  146. package/src/installs/nordvpn.md +0 -1052
  147. package/src/installs/nvm.js +0 -995
  148. package/src/installs/nvm.md +0 -1057
  149. package/src/installs/ohmyzsh.js +0 -529
  150. package/src/installs/ohmyzsh.md +0 -1094
  151. package/src/installs/openssh.js +0 -804
  152. package/src/installs/openssh.md +0 -1056
  153. package/src/installs/pandoc.js +0 -662
  154. package/src/installs/pandoc.md +0 -1036
  155. package/src/installs/parallels-desktop.js +0 -431
  156. package/src/installs/parallels-desktop.md +0 -446
  157. package/src/installs/pinentry.js +0 -510
  158. package/src/installs/pinentry.md +0 -1142
  159. package/src/installs/pngyu.js +0 -869
  160. package/src/installs/pngyu.md +0 -896
  161. package/src/installs/postman.js +0 -799
  162. package/src/installs/postman.md +0 -940
  163. package/src/installs/procps.js +0 -425
  164. package/src/installs/procps.md +0 -851
  165. package/src/installs/safari-tech-preview.js +0 -374
  166. package/src/installs/safari-tech-preview.md +0 -533
  167. package/src/installs/sfnt2woff.js +0 -658
  168. package/src/installs/sfnt2woff.md +0 -795
  169. package/src/installs/shellcheck.js +0 -481
  170. package/src/installs/shellcheck.md +0 -1005
  171. package/src/installs/slack.js +0 -741
  172. package/src/installs/slack.md +0 -865
  173. package/src/installs/snagit.js +0 -585
  174. package/src/installs/snagit.md +0 -844
  175. package/src/installs/software-properties-common.js +0 -372
  176. package/src/installs/software-properties-common.md +0 -805
  177. package/src/installs/spotify.js +0 -877
  178. package/src/installs/spotify.md +0 -901
  179. package/src/installs/studio-3t.js +0 -823
  180. package/src/installs/studio-3t.md +0 -918
  181. package/src/installs/sublime-text.js +0 -804
  182. package/src/installs/sublime-text.md +0 -914
  183. package/src/installs/superwhisper.js +0 -706
  184. package/src/installs/superwhisper.md +0 -630
  185. package/src/installs/tailscale.js +0 -745
  186. package/src/installs/tailscale.md +0 -1100
  187. package/src/installs/tar.js +0 -389
  188. package/src/installs/tar.md +0 -946
  189. package/src/installs/termius.js +0 -798
  190. package/src/installs/termius.md +0 -844
  191. package/src/installs/terraform.js +0 -779
  192. package/src/installs/terraform.md +0 -899
  193. package/src/installs/tfenv.js +0 -778
  194. package/src/installs/tfenv.md +0 -1091
  195. package/src/installs/tidal.js +0 -771
  196. package/src/installs/tidal.md +0 -864
  197. package/src/installs/tmux.js +0 -346
  198. package/src/installs/tmux.md +0 -1030
  199. package/src/installs/tree.js +0 -411
  200. package/src/installs/tree.md +0 -833
  201. package/src/installs/unzip.js +0 -460
  202. package/src/installs/unzip.md +0 -879
  203. package/src/installs/vim.js +0 -421
  204. package/src/installs/vim.md +0 -1040
  205. package/src/installs/vlc.js +0 -821
  206. package/src/installs/vlc.md +0 -927
  207. package/src/installs/vscode.js +0 -843
  208. package/src/installs/vscode.md +0 -1002
  209. package/src/installs/wget.js +0 -420
  210. package/src/installs/wget.md +0 -791
  211. package/src/installs/whatsapp.js +0 -729
  212. package/src/installs/whatsapp.md +0 -854
  213. package/src/installs/winpty.js +0 -352
  214. package/src/installs/winpty.md +0 -620
  215. package/src/installs/woff2.js +0 -553
  216. package/src/installs/woff2.md +0 -977
  217. package/src/installs/wsl.js +0 -572
  218. package/src/installs/wsl.md +0 -699
  219. package/src/installs/xcode-clt.js +0 -520
  220. package/src/installs/xcode-clt.md +0 -351
  221. package/src/installs/xcode.js +0 -560
  222. package/src/installs/xcode.md +0 -573
  223. package/src/installs/yarn.js +0 -824
  224. package/src/installs/yarn.md +0 -1074
  225. package/src/installs/yq.js +0 -654
  226. package/src/installs/yq.md +0 -944
  227. package/src/installs/yt-dlp.js +0 -701
  228. package/src/installs/yt-dlp.md +0 -946
  229. package/src/installs/yum-utils.js +0 -297
  230. package/src/installs/yum-utils.md +0 -648
  231. package/src/installs/zoom.js +0 -759
  232. package/src/installs/zoom.md +0 -884
  233. package/src/installs/zsh.js +0 -455
  234. package/src/installs/zsh.md +0 -1008
  235. package/src/scripts/README.md +0 -617
  236. package/src/scripts/STATUS.md +0 -208
  237. package/src/scripts/afk.js +0 -411
  238. package/src/scripts/backup-all.js +0 -746
  239. package/src/scripts/backup-source.js +0 -727
  240. package/src/scripts/brewd.js +0 -389
  241. package/src/scripts/brewi.js +0 -520
  242. package/src/scripts/brewr.js +0 -527
  243. package/src/scripts/brews.js +0 -477
  244. package/src/scripts/brewu.js +0 -504
  245. package/src/scripts/c.js +0 -201
  246. package/src/scripts/ccurl.js +0 -341
  247. package/src/scripts/certbot-crontab-init.js +0 -504
  248. package/src/scripts/certbot-init.js +0 -657
  249. package/src/scripts/ch.js +0 -355
  250. package/src/scripts/claude-danger.js +0 -268
  251. package/src/scripts/clean-dev.js +0 -435
  252. package/src/scripts/clear-dns-cache.js +0 -541
  253. package/src/scripts/clone.js +0 -435
  254. package/src/scripts/code-all.js +0 -437
  255. package/src/scripts/count-files.js +0 -211
  256. package/src/scripts/count-folders.js +0 -211
  257. package/src/scripts/count.js +0 -264
  258. package/src/scripts/d.js +0 -219
  259. package/src/scripts/datauri.js +0 -389
  260. package/src/scripts/delete-files.js +0 -380
  261. package/src/scripts/docker-clean.js +0 -426
  262. package/src/scripts/dp.js +0 -442
  263. package/src/scripts/e.js +0 -390
  264. package/src/scripts/empty-trash.js +0 -513
  265. package/src/scripts/evm.js +0 -444
  266. package/src/scripts/fetch-github-repos.js +0 -456
  267. package/src/scripts/get-channel.js +0 -345
  268. package/src/scripts/get-course.js +0 -399
  269. package/src/scripts/get-dependencies.js +0 -306
  270. package/src/scripts/get-folder.js +0 -799
  271. package/src/scripts/get-tunes.js +0 -426
  272. package/src/scripts/get-video.js +0 -367
  273. package/src/scripts/git-backup.js +0 -577
  274. package/src/scripts/git-clone.js +0 -493
  275. package/src/scripts/git-pup.js +0 -319
  276. package/src/scripts/git-push.js +0 -396
  277. package/src/scripts/h.js +0 -622
  278. package/src/scripts/hide-desktop-icons.js +0 -499
  279. package/src/scripts/hide-hidden-files.js +0 -538
  280. package/src/scripts/install-dependencies-from.js +0 -456
  281. package/src/scripts/ips.js +0 -663
  282. package/src/scripts/iso.js +0 -370
  283. package/src/scripts/killni.js +0 -577
  284. package/src/scripts/ll.js +0 -467
  285. package/src/scripts/local-ip.js +0 -325
  286. package/src/scripts/m.js +0 -524
  287. package/src/scripts/map.js +0 -309
  288. package/src/scripts/mkd.js +0 -351
  289. package/src/scripts/ncu-update-all.js +0 -457
  290. package/src/scripts/nginx-init.js +0 -718
  291. package/src/scripts/npmi.js +0 -382
  292. package/src/scripts/o.js +0 -511
  293. package/src/scripts/org-by-date.js +0 -338
  294. package/src/scripts/p.js +0 -224
  295. package/src/scripts/packages.js +0 -330
  296. package/src/scripts/path.js +0 -225
  297. package/src/scripts/ports.js +0 -597
  298. package/src/scripts/q.js +0 -305
  299. package/src/scripts/refresh-files.js +0 -394
  300. package/src/scripts/remove-smaller-files.js +0 -516
  301. package/src/scripts/rename-files-with-date.js +0 -533
  302. package/src/scripts/resize-image.js +0 -539
  303. package/src/scripts/rm-safe.js +0 -669
  304. package/src/scripts/s.js +0 -540
  305. package/src/scripts/set-git-public.js +0 -365
  306. package/src/scripts/show-desktop-icons.js +0 -475
  307. package/src/scripts/show-hidden-files.js +0 -472
  308. package/src/scripts/tpa.js +0 -280
  309. package/src/scripts/tpo.js +0 -280
  310. package/src/scripts/u.js +0 -505
  311. package/src/scripts/vpush.js +0 -437
  312. package/src/scripts/y.js +0 -283
  313. package/src/utils/README.md +0 -95
  314. package/src/utils/common/apps.js +0 -143
  315. package/src/utils/common/display.js +0 -157
  316. package/src/utils/common/network.js +0 -185
  317. package/src/utils/common/os.js +0 -294
  318. package/src/utils/common/package-manager.js +0 -301
  319. package/src/utils/common/privileges.js +0 -138
  320. package/src/utils/common/shell.js +0 -261
  321. package/src/utils/macos/apps.js +0 -228
  322. package/src/utils/macos/brew.js +0 -315
  323. package/src/utils/ubuntu/apt.js +0 -307
  324. package/src/utils/ubuntu/desktop.js +0 -292
  325. package/src/utils/ubuntu/snap.js +0 -344
  326. package/src/utils/ubuntu/systemd.js +0 -286
  327. package/src/utils/windows/choco.js +0 -465
  328. package/src/utils/windows/env.js +0 -246
  329. package/src/utils/windows/registry.js +0 -269
  330. package/src/utils/windows/shell.js +0 -240
  331. package/src/utils/windows/winget.js +0 -489
@@ -1,958 +0,0 @@
1
- # Installing Go
2
-
3
- ## Overview
4
-
5
- Go (also known as Golang) is an open-source programming language developed by Google that makes it simple to build secure, scalable systems. Go is statically typed, compiled, and designed for simplicity and reliability. It features built-in concurrency primitives, garbage collection, and a robust standard library, making it ideal for building web servers, cloud services, command-line tools, and distributed systems.
6
-
7
- Go was created by Robert Griesemer, Rob Pike, and Ken Thompson at Google and publicly announced in 2009. The language emphasizes simplicity, readability, and fast compilation times.
8
-
9
- ## Dependencies
10
-
11
- ### macOS (Homebrew)
12
- - **Required:**
13
- - Homebrew - Install via `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"` or `dev install homebrew`
14
- - **Optional:** None
15
- - **Auto-installed:** None (Homebrew handles all package dependencies automatically)
16
-
17
- ### Ubuntu (APT/Snap)
18
- - **Required:**
19
- - `wget` - Install via `sudo apt install wget` (installed automatically by this installer)
20
- - `curl` - Install via `sudo apt install curl` (installed automatically by this installer)
21
- - `tar` - Install via `sudo apt install tar` (typically pre-installed on Ubuntu)
22
- - `sudo` access - Required for system-wide installation to `/usr/local/go`
23
- - **Optional:** None
24
- - **Auto-installed:** None (downloads official tarball from go.dev)
25
-
26
- ### Raspberry Pi OS (APT/Snap)
27
- - **Required:**
28
- - `wget` - Install via `sudo apt install wget` (installed automatically by this installer)
29
- - `curl` - Install via `sudo apt install curl` (installed automatically by this installer)
30
- - `tar` - Install via `sudo apt install tar` (typically pre-installed on Raspberry Pi OS)
31
- - `sudo` access - Required for system-wide installation to `/usr/local/go`
32
- - `uname` - Pre-installed (used for architecture detection: aarch64, armv7l, armv6l)
33
- - **Optional:** None
34
- - **Auto-installed:** None (downloads official ARM tarball from go.dev)
35
-
36
- ### Amazon Linux (DNF/YUM)
37
- - **Required:**
38
- - `wget` - Install via `sudo dnf install wget` or `sudo yum install wget` (installed automatically by this installer)
39
- - `curl` - Install via `sudo dnf install curl` or `sudo yum install curl` (installed automatically by this installer)
40
- - `tar` - Install via `sudo dnf install tar` or `sudo yum install tar` (installed automatically by this installer)
41
- - `sudo` access - Required for system-wide installation to `/usr/local/go`
42
- - Either `dnf` (Amazon Linux 2023) or `yum` (Amazon Linux 2) package manager
43
- - **Optional:** None
44
- - **Auto-installed:** None (downloads official tarball from go.dev)
45
-
46
- ### Windows (Chocolatey/winget)
47
- - **Required:**
48
- - Chocolatey - Install via PowerShell: `Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))`
49
- - PowerShell - Pre-installed on Windows 10/11
50
- - Administrator privileges - Required to run Chocolatey commands
51
- - **Optional:** None
52
- - **Auto-installed:** All Go runtime dependencies are handled automatically by the Chocolatey golang package
53
-
54
- ### Git Bash (Manual/Portable)
55
- - **Required:**
56
- - Chocolatey on Windows host - Install via PowerShell (see Windows section above)
57
- - PowerShell - Pre-installed on Windows 10/11
58
- - Administrator privileges - Required to run Chocolatey commands via PowerShell from Git Bash
59
- - Git Bash - Install via `choco install git` or download from https://git-scm.com/download/win
60
- - **Optional:** None
61
- - **Auto-installed:** All Go runtime dependencies are handled automatically by the Chocolatey golang package on the Windows host
62
-
63
- ## Prerequisites
64
-
65
- Before installing Go on any platform, ensure:
66
-
67
- 1. **Internet connectivity** - Required to download Go packages
68
- 2. **Administrative privileges** - Required for system-wide installation
69
- 3. **Sufficient disk space** - At least 500 MB free disk space recommended
70
- 4. **Terminal/command prompt access** - Required to run installation commands
71
-
72
- **Important**: If you have older Go installations, remove them before installing to avoid conflicts between versions.
73
-
74
- ## Platform-Specific Installation
75
-
76
- ### macOS (Homebrew)
77
-
78
- #### Prerequisites
79
-
80
- - macOS 12 (Monterey) or later
81
- - Homebrew package manager installed
82
- - Apple Silicon (M1/M2/M3/M4) or Intel processor
83
-
84
- If Homebrew is not installed, install it first:
85
-
86
- ```bash
87
- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
88
- ```
89
-
90
- #### Installation Steps
91
-
92
- Run the following command to install Go:
93
-
94
- ```bash
95
- brew install --quiet go
96
- ```
97
-
98
- The `--quiet` flag suppresses non-essential output for cleaner automation. Homebrew automatically:
99
-
100
- - Installs Go to the Homebrew prefix (`/opt/homebrew/Cellar/go/` on Apple Silicon, `/usr/local/Cellar/go/` on Intel)
101
- - Creates symlinks in the Homebrew bin directory
102
- - Adds Go to your PATH (if Homebrew is properly configured)
103
-
104
- **Note**: With modern Go (1.16+), you do not need to set `GOROOT` or `GOPATH` environment variables. Go modules handle dependency management automatically, and `GOPATH` defaults to `~/go`.
105
-
106
- #### Verification
107
-
108
- Confirm the installation succeeded:
109
-
110
- ```bash
111
- go version
112
- ```
113
-
114
- Expected output (version numbers may vary):
115
-
116
- ```
117
- go version go1.25.5 darwin/arm64
118
- ```
119
-
120
- Test that Go is working correctly by running a simple command:
121
-
122
- ```bash
123
- go env GOROOT
124
- ```
125
-
126
- This displays the Go installation directory, confirming the installation is functional.
127
-
128
- #### Troubleshooting
129
-
130
- **Problem**: `go: command not found` after installation
131
-
132
- **Solution**: Homebrew may not be in your PATH. Add Homebrew to your shell configuration:
133
-
134
- For Apple Silicon (M1/M2/M3/M4):
135
-
136
- ```bash
137
- echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
138
- source ~/.zprofile
139
- ```
140
-
141
- For Intel Macs:
142
-
143
- ```bash
144
- echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zprofile
145
- source ~/.zprofile
146
- ```
147
-
148
- **Problem**: Old version of Go installed
149
-
150
- **Solution**: Update Homebrew and upgrade Go:
151
-
152
- ```bash
153
- brew update && brew upgrade go
154
- ```
155
-
156
- **Problem**: Need to install Go binaries globally (like `gopls`, `dlv`)
157
-
158
- **Solution**: Ensure `$HOME/go/bin` is in your PATH:
159
-
160
- ```bash
161
- echo 'export PATH="$PATH:$HOME/go/bin"' >> ~/.zprofile
162
- source ~/.zprofile
163
- ```
164
-
165
- ---
166
-
167
- ### Ubuntu/Debian (APT)
168
-
169
- #### Prerequisites
170
-
171
- - Ubuntu 20.04 (Focal) or later, or Debian 11 (Bullseye) or later (64-bit)
172
- - sudo privileges
173
- - At least 500 MB free disk space
174
-
175
- **Important**: The `golang-go` package in Ubuntu/Debian repositories may be outdated. This guide uses the official Go distribution for the latest stable version.
176
-
177
- First, remove any existing Go installations to avoid conflicts:
178
-
179
- ```bash
180
- sudo DEBIAN_FRONTEND=noninteractive apt-get remove -y golang-go golang 2>/dev/null || true
181
- sudo rm -rf /usr/local/go 2>/dev/null || true
182
- ```
183
-
184
- #### Installation Steps
185
-
186
- **Step 1: Install required utilities**
187
-
188
- ```bash
189
- sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
190
- sudo DEBIAN_FRONTEND=noninteractive apt-get install -y wget curl
191
- ```
192
-
193
- **Step 2: Download and install Go**
194
-
195
- Download the latest stable version and extract to `/usr/local`:
196
-
197
- ```bash
198
- GO_VERSION=$(curl -sL 'https://go.dev/VERSION?m=text' | head -n1)
199
- wget -q "https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz" -O /tmp/go.tar.gz
200
- sudo tar -C /usr/local -xzf /tmp/go.tar.gz
201
- rm /tmp/go.tar.gz
202
- ```
203
-
204
- **Step 3: Configure environment variables**
205
-
206
- Add Go to your PATH by appending to your shell profile:
207
-
208
- ```bash
209
- echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile
210
- echo 'export PATH=$PATH:$HOME/go/bin' >> ~/.profile
211
- source ~/.profile
212
- ```
213
-
214
- The first line adds the Go compiler to PATH. The second line adds the directory where `go install` places binaries.
215
-
216
- #### Verification
217
-
218
- Confirm the installation succeeded:
219
-
220
- ```bash
221
- go version
222
- ```
223
-
224
- Expected output (version numbers may vary):
225
-
226
- ```
227
- go version go1.25.5 linux/amd64
228
- ```
229
-
230
- Verify the environment is configured correctly:
231
-
232
- ```bash
233
- go env GOROOT GOPATH
234
- ```
235
-
236
- Expected output:
237
-
238
- ```
239
- /usr/local/go
240
- /home/<username>/go
241
- ```
242
-
243
- #### Troubleshooting
244
-
245
- **Problem**: `go: command not found` after installation
246
-
247
- **Solution**: The PATH changes require a new shell session. Either log out and log back in, or source your profile:
248
-
249
- ```bash
250
- source ~/.profile
251
- ```
252
-
253
- **Problem**: Permission denied when running `go install`
254
-
255
- **Solution**: Go installs binaries to `$HOME/go/bin` by default, which should not require elevated privileges. If you encounter permission issues, ensure the directory exists and is owned by your user:
256
-
257
- ```bash
258
- mkdir -p ~/go/bin
259
- ```
260
-
261
- **Problem**: Old version persists after installation
262
-
263
- **Solution**: An older version may be installed via apt. Remove it:
264
-
265
- ```bash
266
- sudo DEBIAN_FRONTEND=noninteractive apt-get remove -y golang-go golang
267
- hash -r
268
- go version
269
- ```
270
-
271
- **Problem**: `GOROOT` or `GOPATH` errors
272
-
273
- **Solution**: Modern Go (1.16+) does not require these to be set. If you have them set incorrectly from a previous installation, remove them:
274
-
275
- ```bash
276
- unset GOROOT
277
- unset GOPATH
278
- ```
279
-
280
- ---
281
-
282
- ### Raspberry Pi OS (APT)
283
-
284
- #### Prerequisites
285
-
286
- - Raspberry Pi OS (64-bit recommended) - Bookworm or Bullseye
287
- - Raspberry Pi 3B+ or later (64-bit capable hardware)
288
- - At least 500 MB free disk space
289
- - sudo privileges
290
-
291
- **Important**: You must download the correct Go binary for your architecture. Raspberry Pi OS can run in 32-bit (armv6l/armv7l) or 64-bit (arm64/aarch64) mode.
292
-
293
- First, verify your architecture:
294
-
295
- ```bash
296
- uname -m
297
- ```
298
-
299
- - `aarch64` = 64-bit (recommended, use `linux-arm64`)
300
- - `armv7l` or `armv6l` = 32-bit (use `linux-armv6l`)
301
-
302
- Remove any existing Go installations:
303
-
304
- ```bash
305
- sudo DEBIAN_FRONTEND=noninteractive apt-get remove -y golang-go golang 2>/dev/null || true
306
- sudo rm -rf /usr/local/go 2>/dev/null || true
307
- ```
308
-
309
- #### Installation Steps
310
-
311
- **Step 1: Install required utilities**
312
-
313
- ```bash
314
- sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
315
- sudo DEBIAN_FRONTEND=noninteractive apt-get install -y wget curl
316
- ```
317
-
318
- **Step 2: Download and install Go**
319
-
320
- The following script automatically detects your architecture and downloads the correct version:
321
-
322
- ```bash
323
- GO_VERSION=$(curl -sL 'https://go.dev/VERSION?m=text' | head -n1)
324
- ARCH=$(uname -m)
325
- if [ "$ARCH" = "aarch64" ]; then
326
- GO_ARCH="linux-arm64"
327
- elif [ "$ARCH" = "armv7l" ] || [ "$ARCH" = "armv6l" ]; then
328
- GO_ARCH="linux-armv6l"
329
- else
330
- echo "Unsupported architecture: $ARCH"
331
- exit 1
332
- fi
333
- wget -q "https://go.dev/dl/${GO_VERSION}.${GO_ARCH}.tar.gz" -O /tmp/go.tar.gz
334
- sudo tar -C /usr/local -xzf /tmp/go.tar.gz
335
- rm /tmp/go.tar.gz
336
- ```
337
-
338
- **Step 3: Configure environment variables**
339
-
340
- Add Go to your PATH:
341
-
342
- ```bash
343
- echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile
344
- echo 'export PATH=$PATH:$HOME/go/bin' >> ~/.profile
345
- source ~/.profile
346
- ```
347
-
348
- #### Verification
349
-
350
- Confirm the installation succeeded:
351
-
352
- ```bash
353
- go version
354
- ```
355
-
356
- Expected output for 64-bit (version numbers may vary):
357
-
358
- ```
359
- go version go1.25.5 linux/arm64
360
- ```
361
-
362
- Expected output for 32-bit:
363
-
364
- ```
365
- go version go1.25.5 linux/arm
366
- ```
367
-
368
- #### Troubleshooting
369
-
370
- **Problem**: `cannot execute binary file: Exec format error`
371
-
372
- **Solution**: You downloaded the wrong architecture. Check your architecture with `uname -m` and download the matching version:
373
-
374
- - `aarch64` -> `linux-arm64.tar.gz`
375
- - `armv7l` or `armv6l` -> `linux-armv6l.tar.gz`
376
-
377
- **Problem**: Very slow compilation
378
-
379
- **Solution**: Raspberry Pi has limited CPU and RAM. Compilation is slower than on desktop systems. Consider:
380
-
381
- - Using a faster SD card or USB/SSD boot
382
- - Adding swap space if you have less than 2 GB RAM
383
- - Cross-compiling on a more powerful machine
384
-
385
- **Problem**: Out of memory during compilation
386
-
387
- **Solution**: Add swap space:
388
-
389
- ```bash
390
- sudo fallocate -l 2G /swapfile
391
- sudo chmod 600 /swapfile
392
- sudo mkswap /swapfile
393
- sudo swapon /swapfile
394
- echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
395
- ```
396
-
397
- **Problem**: `apt install golang-go` installs very old version
398
-
399
- **Solution**: The Raspberry Pi OS repositories contain outdated Go versions. Use the manual installation method above for the latest version.
400
-
401
- ---
402
-
403
- ### Amazon Linux (DNF/YUM)
404
-
405
- #### Prerequisites
406
-
407
- - Amazon Linux 2023 (AL2023) or Amazon Linux 2 (AL2)
408
- - sudo privileges
409
- - EC2 instance or compatible environment
410
-
411
- **Note**: Amazon Linux 2023 uses DNF as the package manager. Amazon Linux 2 uses YUM. The version in Amazon's repositories may be older than the latest stable release. This guide uses the official Go distribution for the latest version.
412
-
413
- First, remove any existing Go installations:
414
-
415
- ```bash
416
- sudo rm -rf /usr/local/go 2>/dev/null || true
417
- ```
418
-
419
- #### Installation Steps
420
-
421
- **Step 1: Install required utilities**
422
-
423
- For Amazon Linux 2023:
424
-
425
- ```bash
426
- sudo dnf install -y wget curl tar
427
- ```
428
-
429
- For Amazon Linux 2:
430
-
431
- ```bash
432
- sudo yum install -y wget curl tar
433
- ```
434
-
435
- **Step 2: Download and install Go**
436
-
437
- ```bash
438
- GO_VERSION=$(curl -sL 'https://go.dev/VERSION?m=text' | head -n1)
439
- wget -q "https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz" -O /tmp/go.tar.gz
440
- sudo tar -C /usr/local -xzf /tmp/go.tar.gz
441
- rm /tmp/go.tar.gz
442
- ```
443
-
444
- **Step 3: Configure environment variables**
445
-
446
- Add Go to your PATH:
447
-
448
- ```bash
449
- echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
450
- echo 'export PATH=$PATH:$HOME/go/bin' >> ~/.bashrc
451
- source ~/.bashrc
452
- ```
453
-
454
- **Alternative: Install from Amazon Repositories (older version)**
455
-
456
- If you prefer to use the version from Amazon's repositories (may be older):
457
-
458
- For Amazon Linux 2023:
459
-
460
- ```bash
461
- sudo dnf install -y golang
462
- ```
463
-
464
- For Amazon Linux 2:
465
-
466
- ```bash
467
- sudo yum install -y golang
468
- ```
469
-
470
- **Note**: The repository version may be Go 1.19 or older. Use the manual installation above for the latest version.
471
-
472
- #### Verification
473
-
474
- Confirm the installation succeeded:
475
-
476
- ```bash
477
- go version
478
- ```
479
-
480
- Expected output (version numbers may vary):
481
-
482
- ```
483
- go version go1.25.5 linux/amd64
484
- ```
485
-
486
- Verify the environment:
487
-
488
- ```bash
489
- go env GOROOT
490
- ```
491
-
492
- Expected output:
493
-
494
- ```
495
- /usr/local/go
496
- ```
497
-
498
- #### Troubleshooting
499
-
500
- **Problem**: `go: command not found` after installation
501
-
502
- **Solution**: Source your bash profile or start a new shell session:
503
-
504
- ```bash
505
- source ~/.bashrc
506
- ```
507
-
508
- **Problem**: Repository version is too old
509
-
510
- **Solution**: Use the manual installation method documented above to get the latest version from the official Go website.
511
-
512
- **Problem**: Conflict between manual and repository installations
513
-
514
- **Solution**: Remove the repository version before manual installation:
515
-
516
- For Amazon Linux 2023:
517
-
518
- ```bash
519
- sudo dnf remove -y golang
520
- ```
521
-
522
- For Amazon Linux 2:
523
-
524
- ```bash
525
- sudo yum remove -y golang
526
- ```
527
-
528
- ---
529
-
530
- ### Windows (Chocolatey/winget)
531
-
532
- #### Prerequisites
533
-
534
- - Windows 10 version 1809 or later, or Windows 11
535
- - Administrator PowerShell or Command Prompt
536
- - Chocolatey or winget package manager installed
537
-
538
- If neither package manager is installed, install Chocolatey by running this command in an Administrator PowerShell:
539
-
540
- ```powershell
541
- Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
542
- ```
543
-
544
- #### Installation Steps
545
-
546
- Run the following command in an Administrator PowerShell or Command Prompt:
547
-
548
- ```powershell
549
- choco install golang -y
550
- ```
551
-
552
- The `-y` flag automatically confirms all prompts, enabling fully non-interactive installation. Chocolatey uses the official Go MSI installer with silent installation flags (`/qn /norestart`).
553
-
554
- **Alternative: Using winget**
555
-
556
- If you prefer winget (built into Windows 11 and Windows 10 21H2+):
557
-
558
- ```powershell
559
- winget install --id GoLang.Go --silent --accept-package-agreements --accept-source-agreements
560
- ```
561
-
562
- After installation, close and reopen your terminal for the PATH changes to take effect. Alternatively, in PowerShell, run:
563
-
564
- ```powershell
565
- refreshenv
566
- ```
567
-
568
- #### Verification
569
-
570
- Open a new Command Prompt or PowerShell window, then run:
571
-
572
- ```powershell
573
- go version
574
- ```
575
-
576
- Expected output (version numbers may vary):
577
-
578
- ```
579
- go version go1.25.5 windows/amd64
580
- ```
581
-
582
- Verify the installation path:
583
-
584
- ```powershell
585
- go env GOROOT
586
- ```
587
-
588
- Expected output (default installation):
589
-
590
- ```
591
- C:\Program Files\Go
592
- ```
593
-
594
- #### Troubleshooting
595
-
596
- **Problem**: `go: The term 'go' is not recognized` after installation
597
-
598
- **Solution**: The PATH was not updated. Close and reopen PowerShell, or manually refresh the environment:
599
-
600
- ```powershell
601
- refreshenv
602
- ```
603
-
604
- If using Command Prompt, close and reopen it.
605
-
606
- **Problem**: Installation fails with access denied
607
-
608
- **Solution**: Ensure you are running PowerShell or Command Prompt as Administrator. Right-click the application and select "Run as administrator".
609
-
610
- **Problem**: Old version persists after upgrade
611
-
612
- **Solution**: Uninstall and reinstall Go:
613
-
614
- ```powershell
615
- choco uninstall golang -y
616
- choco install golang -y
617
- ```
618
-
619
- **Problem**: Multiple Go versions installed
620
-
621
- **Solution**: Remove the extra installation. Check `C:\Program Files\Go` and `C:\Go` for duplicate installations.
622
-
623
- ---
624
-
625
- ### WSL (Ubuntu)
626
-
627
- #### Prerequisites
628
-
629
- - Windows 10 version 2004 or later, or Windows 11
630
- - WSL 2 enabled with Ubuntu distribution installed
631
- - sudo privileges within WSL
632
-
633
- **Note**: WSL runs a full Linux environment, so the installation process is identical to native Ubuntu. The commands below are specific to Ubuntu running under WSL.
634
-
635
- First, remove any existing Go installations:
636
-
637
- ```bash
638
- sudo DEBIAN_FRONTEND=noninteractive apt-get remove -y golang-go golang 2>/dev/null || true
639
- sudo rm -rf /usr/local/go 2>/dev/null || true
640
- ```
641
-
642
- #### Installation Steps
643
-
644
- Run these commands in your WSL Ubuntu terminal:
645
-
646
- **Step 1: Install required utilities**
647
-
648
- ```bash
649
- sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
650
- sudo DEBIAN_FRONTEND=noninteractive apt-get install -y wget curl
651
- ```
652
-
653
- **Step 2: Download and install Go**
654
-
655
- ```bash
656
- GO_VERSION=$(curl -sL 'https://go.dev/VERSION?m=text' | head -n1)
657
- wget -q "https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz" -O /tmp/go.tar.gz
658
- sudo tar -C /usr/local -xzf /tmp/go.tar.gz
659
- rm /tmp/go.tar.gz
660
- ```
661
-
662
- **Step 3: Configure environment variables**
663
-
664
- Add Go to your PATH:
665
-
666
- ```bash
667
- echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
668
- echo 'export PATH=$PATH:$HOME/go/bin' >> ~/.bashrc
669
- source ~/.bashrc
670
- ```
671
-
672
- #### Verification
673
-
674
- Confirm the installation succeeded:
675
-
676
- ```bash
677
- go version
678
- ```
679
-
680
- Expected output (version numbers may vary):
681
-
682
- ```
683
- go version go1.25.5 linux/amd64
684
- ```
685
-
686
- #### Troubleshooting
687
-
688
- **Problem**: `go: command not found` after installation
689
-
690
- **Solution**: Source your bash profile or close and reopen the WSL terminal:
691
-
692
- ```bash
693
- source ~/.bashrc
694
- ```
695
-
696
- **Problem**: Very slow file operations when code is on Windows filesystem
697
-
698
- **Solution**: Keep your Go code on the Linux filesystem (`~/projects`) rather than the Windows filesystem (`/mnt/c/`). WSL 2 performs significantly better with files on the native Linux filesystem.
699
-
700
- **Problem**: Cannot access Go tools installed with `go install` from Windows
701
-
702
- **Solution**: Go binaries installed in WSL are Linux executables and cannot run directly from Windows. Use VS Code with the Remote - WSL extension or run Go commands from within WSL.
703
-
704
- **Problem**: IDE cannot find Go installation
705
-
706
- **Solution**: When using VS Code with Remote - WSL extension, ensure you open VS Code from within WSL by running `code .` in your project directory. VS Code will automatically detect the Go installation in WSL.
707
-
708
- ---
709
-
710
- ### Git Bash (Windows Installation)
711
-
712
- #### Prerequisites
713
-
714
- - Windows 10 or Windows 11 (64-bit)
715
- - Git Bash installed (comes with Git for Windows)
716
- - Go installed on Windows (see Windows section)
717
-
718
- **Note**: Git Bash on Windows does not require a separate Go installation. Git Bash inherits the Windows PATH, so once Go is installed on Windows using Chocolatey or winget, the `go` command is automatically available in Git Bash.
719
-
720
- #### Installation Steps
721
-
722
- 1. Install Go on Windows using Chocolatey (see Windows section):
723
-
724
- ```bash
725
- # Run from Administrator PowerShell or Command Prompt
726
- choco install golang -y
727
- ```
728
-
729
- 2. Close and reopen Git Bash to pick up the PATH changes
730
-
731
- 3. The `go` command is now available in Git Bash
732
-
733
- If you need to manually add Go to the Git Bash PATH (typically not required), add to your `~/.bashrc`:
734
-
735
- ```bash
736
- echo 'export PATH="$PATH:/c/Program Files/Go/bin"' >> ~/.bashrc
737
- echo 'export PATH="$PATH:$HOME/go/bin"' >> ~/.bashrc
738
- source ~/.bashrc
739
- ```
740
-
741
- #### Verification
742
-
743
- In Git Bash, confirm Go is accessible:
744
-
745
- ```bash
746
- go version
747
- ```
748
-
749
- Expected output (version numbers may vary):
750
-
751
- ```
752
- go version go1.25.5 windows/amd64
753
- ```
754
-
755
- Test that Go commands work:
756
-
757
- ```bash
758
- go env GOROOT
759
- ```
760
-
761
- Expected output:
762
-
763
- ```
764
- C:\Program Files\Go
765
- ```
766
-
767
- #### Troubleshooting
768
-
769
- **Problem**: `go: command not found` in Git Bash
770
-
771
- **Solution**: The PATH may not be inherited. First, ensure Go is installed on Windows and works in PowerShell/Command Prompt. Then add Go to Git Bash's PATH manually:
772
-
773
- ```bash
774
- echo 'export PATH="$PATH:/c/Program Files/Go/bin"' >> ~/.bashrc
775
- source ~/.bashrc
776
- ```
777
-
778
- **Problem**: Path conversion issues with Go commands
779
-
780
- **Solution**: Git Bash automatically converts Unix-style paths to Windows paths. This can occasionally cause issues. To disable path conversion for a specific command, prefix it with `MSYS_NO_PATHCONV=1`:
781
-
782
- ```bash
783
- MSYS_NO_PATHCONV=1 go build -o /c/Users/me/myapp.exe
784
- ```
785
-
786
- **Problem**: Go modules fail to download (SSL/TLS errors)
787
-
788
- **Solution**: Ensure Git is configured with proper SSL settings:
789
-
790
- ```bash
791
- git config --global http.sslBackend schannel
792
- ```
793
-
794
- **Problem**: `go install` puts binaries in unexpected location
795
-
796
- **Solution**: Go uses `%USERPROFILE%\go\bin` on Windows. In Git Bash, this translates to `$HOME/go/bin`. Ensure this is in your PATH:
797
-
798
- ```bash
799
- echo 'export PATH="$PATH:$HOME/go/bin"' >> ~/.bashrc
800
- source ~/.bashrc
801
- ```
802
-
803
- ---
804
-
805
- ## Post-Installation Configuration
806
-
807
- After installing Go on any platform, consider these optional but recommended configurations.
808
-
809
- ### Verifying Go Modules Work
810
-
811
- Modern Go uses modules for dependency management (enabled by default since Go 1.16). Test that modules work:
812
-
813
- ```bash
814
- mkdir -p /tmp/gotest && cd /tmp/gotest
815
- go mod init example.com/test
816
- go get golang.org/x/tools/gopls@latest
817
- ```
818
-
819
- If this completes without errors, Go modules are working correctly.
820
-
821
- ### Installing Common Development Tools
822
-
823
- Install frequently used Go tools:
824
-
825
- ```bash
826
- go install golang.org/x/tools/gopls@latest # Go language server (for IDE support)
827
- go install github.com/go-delve/delve/cmd/dlv@latest # Debugger
828
- go install golang.org/x/tools/cmd/goimports@latest # Import organizer
829
- ```
830
-
831
- These binaries are installed to `$HOME/go/bin` (or `%USERPROFILE%\go\bin` on Windows). Ensure this directory is in your PATH.
832
-
833
- ### Configuring Your Editor
834
-
835
- **VS Code:**
836
-
837
- 1. Install the "Go" extension by the Go Team at Google
838
- 2. Open a `.go` file and accept the prompt to install Go tools
839
- 3. The extension uses `gopls` for language features
840
-
841
- **GoLand:**
842
-
843
- GoLand automatically detects Go installations. Verify the SDK path in Settings > Go > GOROOT.
844
-
845
- **Vim/Neovim:**
846
-
847
- Install the `vim-go` plugin or use native LSP with `gopls`.
848
-
849
- ### Setting Up Private Module Access
850
-
851
- If you use private Go modules (from private Git repositories), configure Git authentication:
852
-
853
- ```bash
854
- # For GitHub
855
- git config --global url."git@github.com:".insteadOf "https://github.com/"
856
-
857
- # Set GOPRIVATE for your private repos
858
- export GOPRIVATE="github.com/your-org/*"
859
- ```
860
-
861
- Add `GOPRIVATE` to your shell profile for persistence.
862
-
863
- ---
864
-
865
- ## Common Issues
866
-
867
- ### Issue: "go: module requires Go X.Y"
868
-
869
- **Symptoms**: Error message indicating the module requires a newer Go version than installed.
870
-
871
- **Solutions**:
872
-
873
- - Update Go to the latest version using your package manager
874
- - Or use the version specified by the module (check `go.mod`)
875
-
876
- ### Issue: "cannot find package" or Module Download Failures
877
-
878
- **Symptoms**: `go get` or `go build` cannot find or download packages.
879
-
880
- **Solutions**:
881
-
882
- - Ensure you have internet connectivity
883
- - Check if the package exists and the URL is correct
884
- - For corporate networks, configure proxy settings:
885
-
886
- ```bash
887
- export HTTP_PROXY=http://proxy.example.com:8080
888
- export HTTPS_PROXY=http://proxy.example.com:8080
889
- export NO_PROXY=localhost,127.0.0.1
890
- ```
891
-
892
- - For private modules, configure `GOPRIVATE`:
893
-
894
- ```bash
895
- export GOPRIVATE="github.com/your-org/*"
896
- ```
897
-
898
- ### Issue: "GOROOT" or "GOPATH" Confusion
899
-
900
- **Symptoms**: Errors related to GOROOT or GOPATH configuration.
901
-
902
- **Solutions**:
903
-
904
- Modern Go (1.16+) handles these automatically:
905
-
906
- - `GOROOT`: Location of Go installation (auto-detected)
907
- - `GOPATH`: Location for downloaded modules and installed binaries (defaults to `$HOME/go`)
908
-
909
- You typically do not need to set these. If you have them set from an old installation, remove them:
910
-
911
- ```bash
912
- unset GOROOT
913
- unset GOPATH
914
- ```
915
-
916
- ### Issue: "Permission Denied" When Installing Packages
917
-
918
- **Symptoms**: `go install` fails with permission errors.
919
-
920
- **Solutions**:
921
-
922
- Go should install to `$HOME/go/bin`, which does not require root. If it is trying to install elsewhere:
923
-
924
- - Check `go env GOBIN` and `go env GOPATH`
925
- - Ensure `$HOME/go/bin` exists and is writable:
926
-
927
- ```bash
928
- mkdir -p ~/go/bin
929
- ```
930
-
931
- - Never run `go install` with sudo
932
-
933
- ### Issue: Slow First-Time Builds
934
-
935
- **Symptoms**: Initial compilation takes a long time.
936
-
937
- **Solutions**:
938
-
939
- This is normal. Go caches compiled packages, so subsequent builds are much faster. To ensure caching works:
940
-
941
- - Check the cache location: `go env GOCACHE`
942
- - Ensure you have sufficient disk space
943
- - On CI systems, cache the Go build cache and module cache
944
-
945
- ---
946
-
947
- ## References
948
-
949
- - [Go Official Download Page](https://go.dev/dl/)
950
- - [Go Installation Documentation](https://go.dev/doc/install)
951
- - [Go Wiki: Ubuntu](https://go.dev/wiki/Ubuntu)
952
- - [Go Homebrew Formula](https://formulae.brew.sh/formula/go)
953
- - [Go Chocolatey Package](https://community.chocolatey.org/packages/golang)
954
- - [Go winget Package](https://winstall.app/apps/GoLang.Go)
955
- - [AWS: Go in Amazon Linux 2023](https://docs.aws.amazon.com/linux/al2023/ug/go.html)
956
- - [Installing Go on Raspberry Pi](https://www.jeremymorgan.com/tutorials/raspberry-pi/install-go-raspberry-pi/)
957
- - [Installing Go on WSL](https://dev.to/pu-lazydev/installing-go-golang-on-wsl-ubuntu-18b7)
958
- - [Go Modules Documentation](https://go.dev/blog/using-go-modules)