Skip to main content

How To Install Go Lang on Debian 11 / Debian 10

Go is a programming language designed by Google engineers Robert Griesemer, Rob Pike, and Ken Thompson. It is primarily intended to be a modern language: it doesn't have constructs that make you remember your past (like C's structs) or are inspired by other languages (like Python's list comprehensions).

Go's major features are: memory safety without a garbage collector, concurrency without data races, deadlock freedom, and coordination avoidance.

Here, we will see how to install Golang on Debian 11 / Debian 10.

Download and Install Go Language

Install wget package.
sudo apt update sudo apt install wget -y

Visit the Go Language download page to download the latest version of Go. Alternatively, you can download the Go language binary package via terminal using the following command.

Extract the archive to /usr/local.
sudo tar -zxvf go1.17.linux-amd64.tar.gz -C /usr/local/

Setup Go Environment

We will now configure the PATH environment variable to include Go's bin (/usr/local/go/bin) directory. To do that, execute the below command.

For the system-wide installation and load the environment onto your current login session, run the following command.
echo "export PATH=/usr/local/go/bin:${PATH}" | sudo tee /etc/profile.d/ source /etc/profile.d/

For your specific profile and load the environment onto your current login session, run the following command.
echo "export PATH=/usr/local/go/bin:${PATH}" | sudo tee -a $HOME/.profile source $HOME/.profile

Verify Go Installation

Run the below command to see the version of the Go language.
go version

go version go1.17 linux/amd64

Check the Go environment variables we set in previous sections.
go env 

GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/debian/.cache/go-build" GOENV="/home/debian/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/debian/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/debian/go" GOPRIVATE="" GOPROXY=",direct" GOROOT="/usr/local/go" GOSUMDB="" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.17" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1429786228=/tmp/go-build -gno-record-gcc-switches" 

Create First Project

Create a directory hello under your home directory.
mkdir -p hello cd hello

Let's create a simple program (hello) to test the Go installation.

vi hello.go

Place the following content in the hello.go file.
package main import "fmt" func main() { fmt.Printf("Welcome To ITzGeek\n") }

Now, run the code with the go command.
go run .

You would get the following greeting text.
Welcome To ITzGeek

Sumber: disini


Popular posts from this blog

Cara Disable Antimalware Service Executable di Windows 10

Disadari atau tidak, Windows 10 (dan juga windows-windows lainnya) hadir dengan banyak sekali aplikasi bloatware (aplikasi yang tidak perlu-perlu amat dimiliki oleh end user). Contohnya, adalah aplikasi yang seharusnya sudah tergantikan fungsinya oleh antivirus, seperti Antimalware Service Executable . Aplikasi ini dicurigai membuat Windows 10 mengalami inefisiensi memori/RAM, memakan resource yang tinggi, dengan Load yang tinggi (tanpa limit terkadang). Nah, berikut adalah cara men-disable nya: Tekan tombol Windows + I untuk membuka apliaksi Windows Setting. Pilih icon menu Update and Security Pilih lagi menu disamping kiri Windows Security Pada jendela baru yang muncul, ada pilihan Virus & Threat protection Klik ini Lalu matikan proses Real-time protection tersebut. Dengan Regedit. Buka dialog regedit, Windows + R dan ketik ‘regedit’ Cari Folder regedit ini HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender Buat sebuah DWORD baru dengan klik kanan

Setup Debian 11 Official Repository In sources.list (/etc/apt/sources.list)

When you install Debian 11 using a DVD, the OS installer sets the DVD as the source for getting packages for your system if you didn't choose to scan for network mirrors. Due to this reason, the system would ask you to insert a DVD if the disc is not present in the DVD drive when you try to install any software.  Also, the packages on DVD may not be the latest release.  So, we need to get the packages from the Internet. Media change: please insert the disc labeled 'Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04' in the drive '/media/cdrom/' and press [Enter] The /etc/apt/sources.list file with DVD as a source would look something like below. # deb cdrom:[Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04]/ bullseye contrib main deb cdrom:[Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04]/ bullseye contrib main deb bullseye-security

Cara Berlangganan ke Akun OnlyFans

Ada dua jenis akun di OnlyFans: akun pengguna dan akun pembuat konten. Jika Anda berlangganan akun OnlyFans, maka Anda adalah pengguna. Sementara beberapa akun pembuat OnlyFans tidak mengenakan biaya untuk melihat konten mereka, yang lain dapat mengenakan biaya bulanan $50. Dalam artikel ini, kami akan menunjukkan cara berlangganan akun OnlyFans di berbagai perangkat. Kami juga akan membahas proses berlangganan akun OnlyFans tanpa kartu kredit atau debit. Cara Berlangganan Akun OnlyFans Tanpa Menggunakan Kartu Kredit Pribadi Anda Sebagai salah satu platform paling populer di industri hiburan dewasa, OnlyFans memiliki 130 juta pelanggan dan 2 juta kreator. Meskipun ada sedikit kontroversi seputar aplikasi ini, ada akun pengguna baru yang dibuat setiap hari. Jika Anda ingin membuat akun pengguna, Anda harus melakukannya di situs OnlyFans. Ingatlah bahwa Anda harus berusia minimal 18 tahun untuk membuat akun OnlyFans.