blank

mrfdn.com – Pada postingan ini saya ingin mendokumentasikan tentang bagaimana cara saya menjalankan program Go / Golang pertama saya.

Go bisa digunakan untuk membuat aplikasi web, mulai dari rest api, sampai web yang kompleks.

Untuk awal, mari kita belajar menulis codingan go pertama kita.

Pastikan go sudah terinstall di komputer anda.

Pertama, buat direkotory projekan

mkdir mygoprojectcd mygoproject

Inisialisasi projekan go#

Di dalamnya kita inisialisasi projekan go dengan perintah:

Secara otomatis anda akan melihat sebuah file baru bernama go.mod

Isinya kira-kira seperti ini:

module mygoprojectgo 1.22.2

File go.mod ini kemudian akan digunakan untuk menyimpan sedemikian config mengenai package apa yang dibutuhkan. File ini cukup untuk menghandle projekan kecil. Kalau projekan sudah besar, nanti kita tempatkan modul-mudul pada tempat yang semestinya.

Membuat file utama main.go untuk menjalankan web server#

Selanjutnya buat sebuah file bernama main.go

Lalu isi dengan seperti ini:

package mainimport ( "fmt" "net/http")func main() { fmt.Println("halo terminal") mux := http.NewServeMux() mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "hai browser") }) http.ListenAndServe("localhost:8081", mux)}

Struktur folder projekan go#

Sehingga struktur projekan jadi seperti ini:

.├── go.mod└── main.go

Menjalankan projekan go#

Sekarang buka terminala kemudian ketik,

Pada terminal anda akan melihat tulisan halo terminal, dan jika mengakses browser dengan alamat localhost:8081 anda bisa melihat tulisan halo browser.

Compile go project#

Anda bisa compile program go sehingga menjadi sebuah file binary yang bisa langsung dieksekusi dan berjalan.

Cara compile program go:

Nama file binary keluarannya akan sama seperti folder project.

Kalau ingin set spesifik nama file binary, gunakan perintah

Sehingga nama file binary akan menjadi app.

Demikian tutorial singkat tentang cara membuat, menjalankan dan build/compile go / golang.

Semoga bermanfaat.

PakarPBN

A Private Blog Network (PBN) is a collection of websites that are controlled by a single individual or organization and used primarily to build backlinks to a “money site” in order to influence its ranking in search engines such as Google. The core idea behind a PBN is based on the importance of backlinks in Google’s ranking algorithm. Since Google views backlinks as signals of authority and trust, some website owners attempt to artificially create these signals through a controlled network of sites.

In a typical PBN setup, the owner acquires expired or aged domains that already have existing authority, backlinks, and history. These domains are rebuilt with new content and hosted separately, often using different IP addresses, hosting providers, themes, and ownership details to make them appear unrelated. Within the content published on these sites, links are strategically placed that point to the main website the owner wants to rank higher. By doing this, the owner attempts to pass link equity (also known as “link juice”) from the PBN sites to the target website.

The purpose of a PBN is to give the impression that the target website is naturally earning links from multiple independent sources. If done effectively, this can temporarily improve keyword rankings, increase organic visibility, and drive more traffic from search results.

Jasa Backlink

Download Anime Batch

Leave a Reply

Your email address will not be published. Required fields are marked *

TOP