Nadeem Afana's Blog Home

Web Name: Nadeem Afana's Blog Home

WebSite: http://afana.me

ID:135658

Keywords:

Afana,Nadeem,Home,

Description:

Save Disk Space By Installing Golang in the Same Folder on Windows and WSL 30 Oct 2019 · Comments This post explains how to save disk space if you use both GO on Windows and WSL (Windows Subsystem for Linux) by installing GO in each system to the same folder on disk.I used to use Git for Windows before, but then I switched to WSL after it came out. I find WSL faster and has some advantages such as packaging tools (eg APT). I use GO on both Windows and WSL for development, and the last time I looked at the disk space usage of its packages, I saw$ du -hs $HOME/go1.1G /home/nadeem/gofor Linux and another similar number for Windows. This number keeps growing over time. GO as you know relies on package source code and not binaries when building projects, and thus caches packages source code on disk for later use. The packages between Windows and Linux are the same. This sounds like a waste of disk space. I decided to combine both folders into one, and so far I have not had any issues.The following steps describe how to do so: Install GO on Windows by following the online instructions. Open the command prompt as an admin and add permissions to your user AB\nadeem. This is needed to copy files from within WSL: icacls "C:\go" /grant AB\nadeem:F /T where C:\go is where GO was installed on Windows. Download the Linux GO tar file (ie goX.XX.X.linux-amd64.tar.gz) and then extract it into the same folder C:\go skipping existing files: tar --skip-old-files -C '/mnt/c/go/' -xzf /tmp/go1.12.9.linux-amd64.tar.gz If you had installed GO on WSL before then remove its folders. Mount the package folder $HOME/go to point to C:\users\nadeem\go sudo mount -v --bind /mnt/c/users/nadeem/go /home/nadeem/go Make the mount persist by updating /etc/fstab: /home/nadeem/go /mnt/c/users/nadeem/go rw bind,metadata 0 0 Add go bin to the PATH if needed. export PATH=$PATH:"/mnt/c/go/bin" Verify all the steps worked by building an app from both WSL and Windows: In WSL: mkdir hello-go cd hello-go Save the following code into a file called hello.go package main import "fmt" func main() { fmt.Printf("hello, world\n") Run the following in WSL: go mod init hello go build hello.go ./hello Now in a Command prompt window run: cd hello-go go build hello.go hello If you list the files under hello-go folder, you’ll see two binaries: The one generated in Windows and the other one in WSL. dir 10/30/2019 03:58 PM 22 go.mod 10/30/2019 04:01 PM 2,010,168 hello 10/30/2019 04:01 PM 2,075,648 hello.exe 10/30/2019 03:58 PM 97 hello.go Conclusion The package folder used by GO can be enormous and grows over time. Installing GO on both Windows and WSL can be convenient but leads to duplicate disk space usage. This space can be shared between Windows and WSL by installing both to the same folder on disk.

TAGS:Afana Nadeem Home 

<<< Thank you for your visit >>>

Home

Websites to related :
Fat Possum Records

  The Weather Station signs to Fat Possum, releases Robber

Memorial, Ulster Northern Irelan

  The Linen Memorial Installation Was Featured At The Derry Library - Summer of 2017The Belfast Telegraph said:Poignant new exhibition shows fabric of N

Passivhaus Store

  We use cookies to give you the best online experience. By using our website you agree to our use of cookies in accordance with our cookie policy. At P

Phonics Software for Key Stage 1

  The free typing games and lessons on Big Brown Bear have helped thousands of people learn to type since 2005. The games are built using Flash which wi

Home :: PlasticsEurope

  PlasticsEurope s Voluntary Commitment to increasing circularity and resource efficiencyRead more PlasticsEurope launched today the 2020 edition of its

Impending Events

  We provide our 400+ undergraduate students a variety of options with six areas of interest: pre-vet/pre-grad, equine science, business management, foo

税金を払わないとどうなるか|無駄な

  税金を払わないとどうなるか 所得税や消費税などの税金を支払うことは国民の義務です。戦前は税務署が納税額を通達する賦課課税方式でしたが、戦後になって申告

迈博瑞生物膜技术有限公司, 迈博瑞

  公司简介 迈博瑞生物膜技术有限公司为美国Membrane Solutions的独资子公司,是享誉全球的过滤产品供应商。公司在塑料类耗材产品生产方面以及过滤膜供应方面有着超

Ippodaro Natural Salon

  November Specials: 15% OFF a Hair Services for Teachers and Medical Personnel • $75 90-Minute Swedish Massage • $55 Mani-Pedi • Amazing Gift Card D

Lenmar Wood Finishes and Coating

  The ultimate in performance for fine wood finishes, Lenmar® has been a trusted brand for over 65 years. Lenmar is uniquely designed for professional

ads

Hot Websites