{"id":39132,"date":"2026-02-15T04:40:47","date_gmt":"2026-02-15T01:40:47","guid":{"rendered":"https:\/\/fatihsoysal.com\/blog\/?p=39132"},"modified":"2026-02-15T04:40:47","modified_gmt":"2026-02-15T01:40:47","slug":"ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi","status":"publish","type":"post","link":"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/","title":{"rendered":"Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi"},"content":{"rendered":"<p><body><\/p>\n<h2>Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi<\/h2>\n<h3>Giri\u015f<\/h3>\n<p>Go (Golang), Google taraf\u0131ndan geli\u015ftirilen modern, a\u00e7\u0131k kaynakl\u0131 bir programlama dilidir. Y\u00fcksek performans, e\u015fzamanl\u0131l\u0131k (concurrency) deste\u011fi ve geli\u015ftirme kolayl\u0131\u011f\u0131 gibi \u00f6zellikleriyle \u00f6ne \u00e7\u0131kar. Go&#8217;nun en g\u00fc\u00e7l\u00fc yanlar\u0131ndan biri de platformlar aras\u0131 derleme (cross-compilation) yetene\u011fidir. Bu \u00f6zellik, tek bir kod taban\u0131ndan farkl\u0131 i\u015fletim sistemleri (Linux, Windows, macOS vb.) ve donan\u0131m mimarileri (AMD64, ARM, 386 vb.) i\u00e7in ba\u011f\u0131ms\u0131z \u00e7al\u0131\u015ft\u0131r\u0131labilir dosyalar \u00fcretmenize olanak tan\u0131r. Bu, \u00f6zellikle da\u011f\u0131t\u0131m s\u00fcre\u00e7lerini basitle\u015ftirir ve geli\u015ftiricilere b\u00fcy\u00fck bir esneklik sa\u011flar.<\/p>\n<p>Bu makalede, Ubuntu 16.04 i\u015fletim sistemi \u00fczerinde Go uygulamalar\u0131n\u0131 farkl\u0131 platformlar i\u00e7in nas\u0131l derleyece\u011finizi ayr\u0131nt\u0131l\u0131 olarak inceleyece\u011fiz. Ubuntu 16.04, uzun s\u00fcreli destek (LTS) sunan pop\u00fcler bir da\u011f\u0131t\u0131m olup, bir\u00e7ok sunucu ve geli\u015ftirme ortam\u0131nda hala kullan\u0131lmaktad\u0131r. Go&#8217;nun platformlar aras\u0131 derleme mekanizmas\u0131n\u0131, temel kurulumdan geli\u015fmi\u015f otomasyon tekniklerine kadar ad\u0131m ad\u0131m ele alaca\u011f\u0131z.<\/p>\n<h3>Go&#8217;nun Platformlar Aras\u0131 Derleme Yetene\u011finin Temelleri<\/h3>\n<p>Go&#8217;nun platformlar aras\u0131 derleme yetene\u011finin kalbinde iki \u00f6nemli ortam de\u011fi\u015fkeni yatar: <code>GOOS<\/code> ve <code>GOARCH<\/code>.<br \/>\n*   <code>GOOS<\/code> (Go Operating System): Hedef i\u015fletim sistemini belirtir (\u00f6rne\u011fin, <code>linux<\/code>, <code>windows<\/code>, <code>darwin<\/code> (macOS), <code>freebsd<\/code>).<br \/>\n*   <code>GOARCH<\/code> (Go Architecture): Hedef donan\u0131m mimarisini belirtir (\u00f6rne\u011fin, <code>amd64<\/code> (64-bit Intel\/AMD), <code>386<\/code> (32-bit Intel\/AMD), <code>arm<\/code>, <code>arm64<\/code>).<\/p>\n<p>Go derleyicisi, <code>go build<\/code> komutu \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131nda bu ortam de\u011fi\u015fkenlerini kontrol eder. E\u011fer bu de\u011fi\u015fkenler ayarlanmam\u0131\u015fsa, varsay\u0131lan olarak derlemeyi mevcut sistemin i\u015fletim sistemi ve mimarisi i\u00e7in yapar. Ancak, bu de\u011fi\u015fkenleri manuel olarak ayarlayarak, Go&#8217;ya hedef platformun ne oldu\u011funu s\u00f6yleyebilir ve buna g\u00f6re bir \u00e7al\u0131\u015ft\u0131r\u0131labilir dosya \u00fcretmesini sa\u011flayabiliriz.<\/p>\n<p>A\u015fa\u011f\u0131da s\u0131k kullan\u0131lan <code>GOOS<\/code> ve <code>GOARCH<\/code> kombinasyonlar\u0131ndan baz\u0131lar\u0131 listelenmi\u015ftir:<\/p>\n<p>| GOOS      | GOARCH    | A\u00e7\u0131klama                                   |<br \/>\n| :&#8212;&#8212;&#8211; | :&#8212;&#8212;&#8211; | :&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; |<br \/>\n| <code>linux<\/code>   | <code>amd64<\/code>   | 64-bit Linux sistemler (\u00e7o\u011fu sunucu)       |<br \/>\n| <code>linux<\/code>   | <code>386<\/code>     | 32-bit Linux sistemler                     |<br \/>\n| <code>linux<\/code>   | <code>arm<\/code>     | ARM tabanl\u0131 Linux sistemler (\u00f6rn. Raspberry Pi 1, 2, Zero) |<br \/>\n| <code>linux<\/code>   | <code>arm64<\/code>   | 64-bit ARM tabanl\u0131 Linux sistemler (\u00f6rn. Raspberry Pi 3, 4) |<br \/>\n| <code>windows<\/code> | <code>amd64<\/code>   | 64-bit Windows sistemler                   |<br \/>\n| <code>windows<\/code> | <code>386<\/code>     | 32-bit Windows sistemler                   |<br \/>\n| <code>darwin<\/code>  | <code>amd64<\/code>   | Intel tabanl\u0131 macOS sistemler              |<br \/>\n| <code>darwin<\/code>  | <code>arm64<\/code>   | Apple Silicon (M1\/M2) tabanl\u0131 macOS sistemler |<br \/>\n| <code>freebsd<\/code> | <code>amd64<\/code>   | 64-bit FreeBSD sistemler                   |<br \/>\n| <code>openbsd<\/code> | <code>amd64<\/code>   | 64-bit OpenBSD sistemler                   |<\/p>\n<p>Bu kombinasyonlar\u0131 kullanarak, tek bir Go projesinden farkl\u0131 ortamlarda \u00e7al\u0131\u015fabilecek binlerce dosya \u00fcretebiliriz.<\/p>\n<h3>\u00d6n Ko\u015fullar ve Ortam Kurulumu<\/h3>\n<p>Platformlar aras\u0131 derlemeye ba\u015flamadan \u00f6nce, Ubuntu 16.04 sistemimizde Go&#8217;nun kurulu ve do\u011fru \u015fekilde yap\u0131land\u0131r\u0131lm\u0131\u015f olmas\u0131 gerekmektedir.<\/p>\n<h4>Ubuntu 16.04 Sistem Gereksinimleri<\/h4>\n<p>*   Temel bir Ubuntu 16.04 i\u015fletim sistemi kurulumu.<br \/>\n*   \u0130nternet ba\u011flant\u0131s\u0131 (Go SDK&#8217;y\u0131 indirmek i\u00e7in).<br \/>\n*   Terminal eri\u015fimi.<\/p>\n<h4>Go Kurulumu<\/h4>\n<p>Ubuntu 16.04&#8217;te Go&#8217;yu kurman\u0131n birka\u00e7 yolu vard\u0131r. En g\u00fcncel ve tavsiye edilen y\u00f6ntem, Go&#8217;nun resmi web sitesinden tarball (s\u0131k\u0131\u015ft\u0131r\u0131lm\u0131\u015f ar\u015fiv) dosyas\u0131n\u0131 indirip manuel olarak kurmakt\u0131r. Bu y\u00f6ntem, sistemin paket y\u00f6neticisindeki (APT) eski Go s\u00fcr\u00fcmlerinden ka\u00e7\u0131nman\u0131z\u0131 sa\u011flar.<\/p>\n<p>1.  <strong>G\u00fcncel Go S\u00fcr\u00fcm\u00fcn\u00fc \u0130ndirme:<\/strong><br \/>\n    Go&#8217;nun resmi indirme sayfas\u0131n\u0131 (https:\/\/golang.org\/dl\/) ziyaret edin ve Linux i\u00e7in en son kararl\u0131 s\u00fcr\u00fcm\u00fcn <code>tar.gz<\/code> dosyas\u0131n\u0131n indirme ba\u011flant\u0131s\u0131n\u0131 kopyalay\u0131n. A\u015fa\u011f\u0131daki komutla bu dosyay\u0131 indirebilirsiniz (s\u00fcr\u00fcm numaras\u0131n\u0131 g\u00fcncel olanla de\u011fi\u015ftirin):<\/p>\n<pre><code class=\"language-bash\">wget https:\/\/golang.org\/dl\/go1.22.4.linux-amd64.tar.gz<\/code><\/pre>\n<p>    <em>Not: Ubuntu 16.04 genellikle 64-bit mimariye sahiptir, bu y\u00fczden <code>amd64<\/code> s\u00fcr\u00fcm\u00fcn\u00fc indiriyoruz. E\u011fer 32-bit bir sisteminiz varsa, <code>386<\/code> s\u00fcr\u00fcm\u00fcn\u00fc indirmelisiniz.<\/em><\/p>\n<p>2.  <strong>Ar\u015fivi \u00c7\u0131karma:<\/strong><br \/>\n    \u0130ndirilen dosyay\u0131 genellikle <code>\/usr\/local<\/code> dizinine \u00e7\u0131kar\u0131r\u0131z. Bu, Go&#8217;nun sistem genelinde eri\u015filebilir olmas\u0131n\u0131 sa\u011flar.<\/p>\n<pre><code class=\"language-bash\">sudo tar -C \/usr\/local -xzf go1.22.4.linux-amd64.tar.gz<\/code><\/pre>\n<p>3.  <strong>PATH Ortam De\u011fi\u015fkenini Ayarlama:<\/strong><br \/>\n    Go komutlar\u0131n\u0131n terminalden \u00e7al\u0131\u015fabilmesi i\u00e7in Go&#8217;nun <code>bin<\/code> dizinini <code>PATH<\/code> ortam de\u011fi\u015fkenine eklememiz gerekir. Bu ayar\u0131 kal\u0131c\u0131 hale getirmek i\u00e7in genellikle kullan\u0131c\u0131n\u0131n <code>.profile<\/code> veya <code>.bashrc<\/code> dosyas\u0131na ekleriz.<\/p>\n<pre><code class=\"language-bash\">echo 'export PATH=$PATH:\/usr\/local\/go\/bin' >> ~\/.profile\n    source ~\/.profile<\/code><\/pre>\n<p>    Bu komut, <code>\/usr\/local\/go\/bin<\/code> yolunu <code>PATH<\/code> de\u011fi\u015fkeninize ekler ve ard\u0131ndan <code>.profile<\/code> dosyas\u0131n\u0131 yeniden y\u00fckleyerek de\u011fi\u015fiklikleri hemen aktif hale getirir.<\/p>\n<p>4.  <strong>Go Kurulumunu Do\u011frulama:<\/strong><br \/>\n    Kurulumun ba\u015far\u0131l\u0131 olup olmad\u0131\u011f\u0131n\u0131 kontrol etmek i\u00e7in Go s\u00fcr\u00fcm\u00fcn\u00fc sorgulayabiliriz:<\/p>\n<pre><code class=\"language-bash\">go version<\/code><\/pre>\n<p>    \u00c7\u0131kt\u0131 olarak <code>go version go1.22.4 linux\/amd64<\/code> (veya indirdi\u011finiz s\u00fcr\u00fcm) benzeri bir mesaj almal\u0131s\u0131n\u0131z.<\/p>\n<h4>GOPATH ve \u00c7al\u0131\u015fma Alan\u0131<\/h4>\n<p>Go 1.11 s\u00fcr\u00fcm\u00fcnden itibaren Go Mod\u00fcller (Go Modules) tan\u0131t\u0131ld\u0131 ve <code>GOPATH<\/code>&#8216;\u0131n \u00f6nemi azald\u0131. Ancak, eski projelerle \u00e7al\u0131\u015f\u0131rken veya Go Mod\u00fclleri kullanmadan basit \u00f6rnekler olu\u015ftururken <code>GOPATH<\/code> hala bir rol oynayabilir. <code>GOPATH<\/code>, Go \u00e7al\u0131\u015fma alan\u0131n\u0131z\u0131n k\u00f6k dizinidir ve Go&#8217;nun kaynak kodlar\u0131n\u0131, derlenmi\u015f paketlerini ve \u00e7al\u0131\u015ft\u0131r\u0131labilir dosyalar\u0131n\u0131 depolad\u0131\u011f\u0131 yerdir.<\/p>\n<p>Go Mod\u00fclleri kullan\u0131yorsan\u0131z, projenizin herhangi bir dizinde olmas\u0131 yeterlidir ve <code>GOPATH<\/code>&#8216;e ba\u011f\u0131ml\u0131 de\u011fildir. Bu makaledeki \u00f6rnekler i\u00e7in Go Mod\u00fclleri kullanaca\u011f\u0131m\u0131zdan, <code>GOPATH<\/code>&#8216;i manuel olarak ayarlaman\u0131za gerek yoktur. Go Mod\u00fclleri, Go 1.11&#8217;den sonra varsay\u0131lan olarak etkindir.<\/p>\n<h3>Basit Bir Go Uygulamas\u0131 Olu\u015fturma<\/h3>\n<p>Platformlar aras\u0131 derleme yetene\u011fini g\u00f6stermek i\u00e7in basit bir Go uygulamas\u0131 olu\u015ftural\u0131m.<\/p>\n<p>1.  <strong>Proje Dizini Olu\u015fturma:<\/strong><br \/>\n    \u00d6ncelikle projemiz i\u00e7in bir dizin olu\u015ftural\u0131m ve i\u00e7ine girelim:<\/p>\n<pre><code class=\"language-bash\">mkdir myapp\n    cd myapp<\/code><\/pre>\n<p>2.  <strong>Go Mod\u00fcl\u00fcn\u00fc Ba\u015flatma:<\/strong><br \/>\n    Go Mod\u00fclleri kullanaca\u011f\u0131m\u0131z i\u00e7in, projemizde bir mod\u00fcl ba\u015flatmam\u0131z gerekiyor. Bu, ba\u011f\u0131ml\u0131l\u0131k y\u00f6netimini kolayla\u015ft\u0131r\u0131r.<\/p>\n<pre><code class=\"language-bash\">go mod init myapp<\/code><\/pre>\n<p>    Bu komut, projenizin k\u00f6k dizininde <code>go.mod<\/code> ad\u0131nda bir dosya olu\u015fturacakt\u0131r.<\/p>\n<p>3.  <strong><code>main.go<\/code> Dosyas\u0131n\u0131 Olu\u015fturma:<\/strong><br \/>\n    \u015eimdi <code>main.go<\/code> ad\u0131nda bir dosya olu\u015ftural\u0131m ve i\u00e7ine a\u015fa\u011f\u0131daki kodu ekleyelim:<\/p>\n<pre><code class=\"language-go\">\/\/ main.go\n    package main\n\n    import (\n    \t\"fmt\"\n    \t\"runtime\"\n    )\n\n    func main() {\n    \tfmt.Printf(\"Merhaba, D\u00fcnya! Ben %s \u00fczerinde %s mimarisinde \u00e7al\u0131\u015f\u0131yorum.\\n\", runtime.GOOS, runtime.GOARCH)\n    }<\/code><\/pre>\n<p>    Bu basit program, \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131 i\u015fletim sistemini ve mimarisini ekrana yazd\u0131r\u0131r. Bu, derlenen uygulaman\u0131n hangi platform i\u00e7in \u00fcretildi\u011fini do\u011frulamam\u0131za yard\u0131mc\u0131 olacakt\u0131r.<\/p>\n<h3>Farkl\u0131 Platformlar \u0130\u00e7in Derleme Ad\u0131mlar\u0131<\/h3>\n<p>\u015eimdi <code>myapp<\/code> uygulamas\u0131n\u0131 farkl\u0131 platformlar i\u00e7in derleyelim.<\/p>\n<h4>Linux (Yerel Sistem) \u0130\u00e7in Derleme<\/h4>\n<p>\u0130lk olarak, uygulamay\u0131 mevcut Ubuntu 16.04 sistemimiz i\u00e7in derleyelim. Bu, varsay\u0131lan derleme davran\u0131\u015f\u0131d\u0131r.<\/p>\n<pre><code class=\"language-bash\">go build -o myapp-linux-amd64 main.go<\/code><\/pre>\n<p>*   <code>-o myapp-linux-amd64<\/code>: Olu\u015fturulacak \u00e7al\u0131\u015ft\u0131r\u0131labilir dosyan\u0131n ad\u0131n\u0131 belirtir.<br \/>\n*   <code>main.go<\/code>: Derlenecek kaynak dosyam\u0131z.<\/p>\n<p>Bu komut, <code>myapp<\/code> dizininin i\u00e7ine <code>myapp-linux-amd64<\/code> ad\u0131nda bir \u00e7al\u0131\u015ft\u0131r\u0131labilir dosya olu\u015fturacakt\u0131r. Bu dosyay\u0131 do\u011frudan \u00e7al\u0131\u015ft\u0131rabilirsiniz:<\/p>\n<pre><code class=\"language-bash\">.\/myapp-linux-amd64<\/code><\/pre>\n<p>\u00c7\u0131kt\u0131: <code>Merhaba, D\u00fcnya! Ben linux \u00fczerinde amd64 mimarisinde \u00e7al\u0131\u015f\u0131yorum.<\/code><\/p>\n<h4>Windows \u0130\u00e7in Derleme<\/h4>\n<p>Uygulamay\u0131 64-bit Windows i\u00e7in derleyelim. Bunun i\u00e7in <code>GOOS<\/code> de\u011fi\u015fkenini <code>windows<\/code> ve <code>GOARCH<\/code> de\u011fi\u015fkenini <code>amd64<\/code> olarak ayarlamam\u0131z gerekir.<\/p>\n<pre><code class=\"language-bash\">GOOS=windows GOARCH=amd64 go build -o myapp-windows-amd64.exe main.go<\/code><\/pre>\n<p>*   Go derleyicisi, <code>GOOS=windows<\/code> olarak ayarland\u0131\u011f\u0131nda \u00e7\u0131kt\u0131 dosyas\u0131na otomatik olarak <code>.exe<\/code> uzant\u0131s\u0131n\u0131 ekleyecektir.<br \/>\n*   Bu komut, <code>myapp-windows-amd64.exe<\/code> ad\u0131nda bir dosya olu\u015fturur. Bu dosyay\u0131 bir Windows sistemine kopyalay\u0131p \u00e7al\u0131\u015ft\u0131rd\u0131\u011f\u0131n\u0131zda, Windows ortam\u0131na \u00f6zg\u00fc \u00e7\u0131kt\u0131y\u0131 g\u00f6receksiniz.<\/p>\n<p>32-bit Windows i\u00e7in derlemek isterseniz, <code>GOARCH<\/code> de\u011ferini <code>386<\/code> olarak de\u011fi\u015ftirebilirsiniz:<\/p>\n<pre><code class=\"language-bash\">GOOS=windows GOARCH=386 go build -o myapp-windows-386.exe main.go<\/code><\/pre>\n<h4>macOS (Darwin) \u0130\u00e7in Derleme<\/h4>\n<p>Uygulamay\u0131 Intel tabanl\u0131 macOS sistemler (eski Mac&#8217;ler) i\u00e7in derleyelim.<\/p>\n<pre><code class=\"language-bash\">GOOS=darwin GOARCH=amd64 go build -o myapp-darwin-amd64 main.go<\/code><\/pre>\n<p>Bu komut, <code>myapp-darwin-amd64<\/code> ad\u0131nda bir dosya olu\u015fturur. Bu dosyay\u0131 Intel tabanl\u0131 bir macOS sisteminde \u00e7al\u0131\u015ft\u0131rabilirsiniz.<\/p>\n<p>Apple Silicon (M1, M2 vb.) tabanl\u0131 yeni Mac&#8217;ler i\u00e7in derlemek isterseniz:<\/p>\n<pre><code class=\"language-bash\">GOOS=darwin GOARCH=arm64 go build -o myapp-darwin-arm64 main.go<\/code><\/pre>\n<p>Bu, <code>myapp-darwin-arm64<\/code> ad\u0131nda bir dosya olu\u015fturacakt\u0131r.<\/p>\n<h4>ARM Tabanl\u0131 Sistemler (\u00f6rn. Raspberry Pi) \u0130\u00e7in Derleme<\/h4>\n<p>Go, ARM mimarisi i\u00e7in de m\u00fckemmel destek sunar, bu da Raspberry Pi gibi g\u00f6m\u00fcl\u00fc sistemler i\u00e7in uygulama geli\u015ftirmeyi kolayla\u015ft\u0131r\u0131r.<\/p>\n<p>64-bit ARM tabanl\u0131 Linux sistemler (\u00f6rn. Raspberry Pi 3 veya 4&#8217;\u00fcn 64-bit i\u015fletim sistemi):<\/p>\n<pre><code class=\"language-bash\">GOOS=linux GOARCH=arm64 go build -o myapp-linux-arm64 main.go<\/code><\/pre>\n<p>Bu komut, <code>myapp-linux-arm64<\/code> ad\u0131nda bir dosya olu\u015fturur.<\/p>\n<p>32-bit ARM tabanl\u0131 Linux sistemler (\u00f6rn. Raspberry Pi 1, 2, Zero veya 32-bit i\u015fletim sistemi \u00e7al\u0131\u015ft\u0131ran Raspberry Pi 3\/4):<\/p>\n<pre><code class=\"language-bash\">GOOS=linux GOARCH=arm go build -o myapp-linux-arm main.go<\/code><\/pre>\n<p>Bu durumda, Go derleyicisi varsay\u0131lan olarak ARMv7 mimarisi i\u00e7in derleme yapar. E\u011fer daha eski bir ARM mimarisi (\u00f6rn. ARMv5, ARMv6) i\u00e7in derleme yapman\u0131z gerekiyorsa, <code>GOARM<\/code> ortam de\u011fi\u015fkenini kullanabilirsiniz:<\/p>\n<pre><code class=\"language-bash\">GOOS=linux GOARCH=arm GOARM=6 go build -o myapp-linux-armv6 main.go # Raspberry Pi Zero, 1, 2 i\u00e7in\nGOOS=linux GOARCH=arm GOARM=7 go build -o myapp-linux-armv7 main.go # Raspberry Pi 2, 3 i\u00e7in<\/code><\/pre>\n<p><code>GOARM<\/code> de\u011fi\u015fkeni, ARM mimarisi i\u00e7in derleme yaparken kullan\u0131lan ARM versiyonunu belirtir (\u00f6rn. <code>5<\/code>, <code>6<\/code>, <code>7<\/code>).<\/p>\n<h3>\u00d6nemli Bir Detay: CGO_ENABLED<\/h3>\n<p>Go&#8217;nun platformlar aras\u0131 derleme yetene\u011fi genellikle &#8220;statik&#8221; \u00e7al\u0131\u015ft\u0131r\u0131labilir dosyalar \u00fcretmesiyle bilinir. Bu, Go&#8217;nun derledi\u011fi binary&#8217;nin, hedef sistemde ba\u015fka bir k\u00fct\u00fcphaneye (\u00f6zellikle C k\u00fct\u00fcphanelerine) ba\u011f\u0131ml\u0131 olmamas\u0131 anlam\u0131na gelir. Ancak, Go&#8217;nun C koduyla etkile\u015fime girmesini sa\u011flayan <code>cgo<\/code> \u00f6zelli\u011fi bu durumu de\u011fi\u015ftirebilir.<\/p>\n<h4>CGO Nedir?<\/h4>\n<p><code>cgo<\/code>, Go kodunuzun C kodunu \u00e7a\u011f\u0131rmas\u0131na veya C k\u00fct\u00fcphanelerini kullanmas\u0131na olanak tan\u0131r. E\u011fer Go uygulaman\u0131z <code>cgo<\/code> kullanarak C kodu \u00e7a\u011f\u0131r\u0131yorsa, derleme s\u0131ras\u0131nda Go derleyicisi bir C derleyicisine (\u00f6rn. GCC) ihtiya\u00e7 duyar ve olu\u015fturulan \u00e7al\u0131\u015ft\u0131r\u0131labilir dosya, hedef sistemde kullan\u0131lan C k\u00fct\u00fcphanelerine (\u00f6rn. <code>glibc<\/code>) dinamik olarak ba\u011flanabilir.<\/p>\n<h4>Platformlar Aras\u0131 Derlemede Neden Sorun Yarat\u0131r?<\/h4>\n<p>E\u011fer <code>cgo<\/code> etkinse (<code>CGO_ENABLED=1<\/code>, varsay\u0131lan de\u011fer), platformlar aras\u0131 derleme karma\u015f\u0131kla\u015f\u0131r. Bunun nedeni \u015funlard\u0131r:<br \/>\n1.  <strong>Hedef C Derleyicisi Gereksinimi:<\/strong> Derleme yap\u0131lan sistemde, hedef platform i\u00e7in bir C derleyicisi (cross-compiler) kurulu olmas\u0131 gerekir. \u00d6rne\u011fin, Windows i\u00e7in derleme yaparken Linux sisteminizde <code>mingw-w64<\/code> gibi bir cross-compiler kurulu olmal\u0131d\u0131r.<br \/>\n2.  <strong>K\u00fct\u00fcphane Ba\u011f\u0131ml\u0131l\u0131klar\u0131:<\/strong> Olu\u015fturulan Go binary&#8217;si, hedef sistemdeki belirli C k\u00fct\u00fcphanelerine dinamik olarak ba\u011f\u0131ml\u0131 hale gelebilir. Bu k\u00fct\u00fcphaneler hedef sistemde bulunmazsa veya farkl\u0131 bir s\u00fcr\u00fcmdeyse, uygulama \u00e7al\u0131\u015fmayabilir.<\/p>\n<h4><code>CGO_ENABLED=0<\/code> Kullan\u0131m\u0131n\u0131n \u00d6nemi<\/h4>\n<p>Bu sorunlar\u0131 a\u015fmak ve ger\u00e7ekten statik, ba\u011f\u0131ms\u0131z \u00e7al\u0131\u015ft\u0131r\u0131labilir dosyalar \u00fcretmek i\u00e7in <code>CGO_ENABLED=0<\/code> ortam de\u011fi\u015fkenini kullan\u0131r\u0131z. Bu de\u011fi\u015fken, Go derleyicisine <code>cgo<\/code>&#8216;yu tamamen devre d\u0131\u015f\u0131 b\u0131rakmas\u0131n\u0131 s\u00f6yler.<\/p>\n<pre><code class=\"language-bash\">CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o myapp-windows-amd64.exe main.go<\/code><\/pre>\n<p>Bu komut, <code>cgo<\/code>&#8216;ya ba\u011f\u0131ml\u0131 olmayan tamamen statik bir Windows \u00e7al\u0131\u015ft\u0131r\u0131labilir dosyas\u0131 olu\u015fturur. Bu, genellikle platformlar aras\u0131 derleme yaparken tercih edilen yakla\u015f\u0131md\u0131r, \u00e7\u00fcnk\u00fc hedef sistemde ek ba\u011f\u0131ml\u0131l\u0131klar\u0131n olmamas\u0131n\u0131 garanti eder.<\/p>\n<p><strong>Ne Zaman <code>CGO_ENABLED=1<\/code> Kullanmak \u0130steriz?<\/strong><br \/>\nNadiren de olsa, Go uygulaman\u0131z\u0131n belirli C k\u00fct\u00fcphanelerine (\u00f6rn. SQLite&#8217;\u0131n <code>cgo<\/code> tabanl\u0131 s\u00fcr\u00fcmleri, baz\u0131 grafik k\u00fct\u00fcphaneleri) bilin\u00e7li olarak ba\u011f\u0131ml\u0131 olmas\u0131 gerekebilir. Bu durumlarda <code>CGO_ENABLED=1<\/code> kullanmak zorunda kal\u0131rs\u0131n\u0131z. Ancak, bu durumda platformlar aras\u0131 derleme yapmak \u00e7ok daha zorla\u015f\u0131r ve hedef platform i\u00e7in uygun bir cross-C derleyicisi kurman\u0131z ve k\u00fct\u00fcphane ba\u011f\u0131ml\u0131l\u0131klar\u0131n\u0131 manuel olarak y\u00f6netmeniz gerekebilir. \u00c7o\u011fu Go uygulamas\u0131nda <code>CGO_ENABLED=0<\/code> kullan\u0131m\u0131 sorunsuz bir \u015fekilde platformlar aras\u0131 derlemeyi m\u00fcmk\u00fcn k\u0131lar.<\/p>\n<h3>Geli\u015fmi\u015f Derleme Teknikleri ve En \u0130yi Uygulamalar<\/h3>\n<p>Farkl\u0131 platformlar i\u00e7in tek tek komut \u00e7al\u0131\u015ft\u0131rmak zaman al\u0131c\u0131 olabilir. Bu b\u00f6l\u00fcmde, s\u00fcreci otomatikle\u015ftirmek ve daha karma\u015f\u0131k senaryolar\u0131 y\u00f6netmek i\u00e7in kullan\u0131labilecek geli\u015fmi\u015f teknikleri inceleyece\u011fiz.<\/p>\n<h4>Derleme Etiketleri (Build Tags)<\/h4>\n<p>Go&#8217;nun derleme etiketleri, belirli ko\u015fullara g\u00f6re kod par\u00e7ac\u0131klar\u0131n\u0131 derlemeye dahil etmenize veya hari\u00e7 tutman\u0131za olanak tan\u0131r. Bu, platforma \u00f6zel kod yazman\u0131z gerekti\u011finde \u00e7ok kullan\u0131\u015fl\u0131d\u0131r.<\/p>\n<p><strong>Kullan\u0131m:<\/strong><br \/>\nBir Go dosyas\u0131n\u0131n ba\u015f\u0131na <code>\/\/ +build<\/code> y\u00f6nergesini ekleyerek derleme etiketlerini kullanabilirsiniz. \u00d6rne\u011fin:<br \/>\n*   <code>\/\/ +build linux<\/code>: Bu dosya yaln\u0131zca Linux i\u00e7in derlenirken dahil edilecek.<br \/>\n*   <code>\/\/ +build windows<\/code>: Bu dosya yaln\u0131zca Windows i\u00e7in derlenirken dahil edilecek.<br \/>\n*   <code>\/\/ +build !windows<\/code>: Bu dosya Windows d\u0131\u015f\u0131ndaki t\u00fcm platformlar i\u00e7in derlenirken dahil edilecek.<\/p>\n<p><strong>\u00d6rnek:<\/strong><br \/>\n<code>platform_specific.go<\/code> ad\u0131nda bir dosya olu\u015ftural\u0131m:<\/p>\n<pre><code class=\"language-go\">\/\/ +build linux\n\npackage main\n\nimport \"fmt\"\n\nfunc init() {\n\tfmt.Println(\"Linux'a \u00f6zel ba\u015flatma fonksiyonu \u00e7al\u0131\u015ft\u0131.\")\n}\n\nfunc getPlatformMessage() string {\n\treturn \"Bu mesaj Linux sisteminden geldi.\"\n}<\/code><\/pre>\n<p>\u015eimdi <code>windows_specific.go<\/code> ad\u0131nda ba\u015fka bir dosya olu\u015ftural\u0131m:<\/p>\n<pre><code class=\"language-go\">\/\/ +build windows\n\npackage main\n\nimport \"fmt\"\n\nfunc init() {\n\tfmt.Println(\"Windows'a \u00f6zel ba\u015flatma fonksiyonu \u00e7al\u0131\u015ft\u0131.\")\n}\n\nfunc getPlatformMessage() string {\n\treturn \"Bu mesaj Windows sisteminden geldi.\"\n}<\/code><\/pre>\n<p>Ve <code>main.go<\/code> dosyam\u0131z\u0131 g\u00fcncelleyelim:<\/p>\n<pre><code class=\"language-go\">package main\n\nimport (\n\t\"fmt\"\n\t\"runtime\"\n)\n\nfunc main() {\n\tfmt.Printf(\"Merhaba, D\u00fcnya! Ben %s \u00fczerinde %s mimarisinde \u00e7al\u0131\u015f\u0131yorum.\\n\", runtime.GOOS, runtime.GOARCH)\n\tfmt.Println(getPlatformMessage())\n}<\/code><\/pre>\n<p>\u015eimdi derledi\u011fimizde:<br \/>\n*   Linux i\u00e7in: <code>go build -o myapp-linux-amd64 main.go<\/code> -> <code>platform_specific.go<\/code> dahil edilir.<br \/>\n*   Windows i\u00e7in: <code>GOOS=windows GOARCH=amd64 go build -o myapp-windows-amd64.exe main.go<\/code> -> <code>windows_specific.go<\/code> dahil edilir.<\/p>\n<p>Derleme etiketleri, Go&#8217;nun platformlar aras\u0131 derleme yetene\u011fini daha da g\u00fc\u00e7l\u00fc hale getirir, \u00e7\u00fcnk\u00fc kodunuzun belirli b\u00f6l\u00fcmlerini yaln\u0131zca ilgili platformlar i\u00e7in derleyebilirsiniz.<\/p>\n<h4>Otomasyon \u0130\u00e7in Kabuk Betikleri (Shell Scripts)<\/h4>\n<p>Birden fazla platform i\u00e7in derleme yapmak, bir\u00e7ok komut \u00e7al\u0131\u015ft\u0131rmak anlam\u0131na gelir. Bu s\u00fcreci otomatikle\u015ftirmek i\u00e7in basit bir kabuk beti\u011fi (shell script) kullanabiliriz.<\/p>\n<p><code>build.sh<\/code> ad\u0131nda bir dosya olu\u015ftural\u0131m:<\/p>\n<pre><code class=\"language-bash\">#!\/bin\/bash\n\n<h2>\u00c7\u0131k\u0131\u015f dizini olu\u015fturma<\/h2>\nmkdir -p bin\n\n<h2>Derlenecek platformlar listesi<\/h2>\nplatforms=(\n    \"linux\/amd64\"\n    \"linux\/386\"\n    \"linux\/arm\"\n    \"linux\/arm64\"\n    \"windows\/amd64\"\n    \"windows\/386\"\n    \"darwin\/amd64\"\n    \"darwin\/arm64\"\n)\n\n<h2>Uygulama ad\u0131<\/h2>\nAPP_NAME=\"myapp\"\n\necho \"Farkl\u0131 platformlar i\u00e7in Go uygulamas\u0131 derleniyor...\"\n\nfor platform in \"${platforms[@]}\"\ndo\n    GOOS=$(echo $platform | cut -d'\/' -f1)\n    GOARCH=$(echo $platform | cut -d'\/' -f2)\n    OUTPUT_NAME=\"${APP_NAME}-${GOOS}-${GOARCH}\"\n\n    if [ \"$GOOS\" = \"windows\" ]; then\n        OUTPUT_NAME+=\".exe\"\n    fi\n\n    echo \"Derleniyor: ${GOOS}\/${GOARCH} -> bin\/${OUTPUT_NAME}\"\n    CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH go build -o \"bin\/${OUTPUT_NAME}\" main.go\n    if [ $? -ne 0 ]; then\n        echo \"HATA: ${GOOS}\/${GOARCH} i\u00e7in derleme ba\u015far\u0131s\u0131z oldu!\"\n        exit 1\n    fi\ndone\n\necho \"T\u00fcm derlemeler tamamland\u0131!\"\nls -l bin\/<\/code><\/pre>\n<p>Bu betik, tan\u0131mlanan her platform i\u00e7in uygulamay\u0131 derler ve \u00e7\u0131kt\u0131lar\u0131 <code>bin<\/code> dizinine kaydeder. Beti\u011fi \u00e7al\u0131\u015ft\u0131r\u0131labilir hale getirmeyi unutmay\u0131n:<\/p>\n<pre><code class=\"language-bash\">chmod +x build.sh\n.\/build.sh<\/code><\/pre>\n<h4>Makefile Kullan\u0131m\u0131<\/h4>\n<p>Daha karma\u015f\u0131k projelerde veya ba\u011f\u0131ml\u0131l\u0131klar\u0131 olan derleme s\u00fcre\u00e7lerinde Makefile&#8217;lar daha d\u00fczenli bir \u00e7\u00f6z\u00fcm sunabilir.<br \/>\n<code>Makefile<\/code> ad\u0131nda bir dosya olu\u015ftural\u0131m:<\/p>\n<pre><code class=\"language-makefile\">.PHONY: all clean\n\nAPP_NAME := myapp\nBUILD_DIR := bin\nSOURCES := main.go\n\nPLATFORMS := \\\n\tlinux\/amd64 \\\n\tlinux\/386 \\\n\tlinux\/arm \\\n\tlinux\/arm64 \\\n\twindows\/amd64 \\\n\twindows\/386 \\\n\tdarwin\/amd64 \\\n\tdarwin\/arm64\n\nall: $(BUILD_DIR) $(addprefix $(BUILD_DIR)\/, $(addsuffix .exe, $(filter %\/windows\/%, $(PLATFORMS))) $(filter-out %\/windows\/%, $(PLATFORMS)))\n\n$(BUILD_DIR):\n\tmkdir -p $(BUILD_DIR)\n\n$(BUILD_DIR)\/% :\n\t$(eval GOOS := $(shell echo $* | cut -d'\/' -f1))\n\t$(eval GOARCH := $(shell echo $* | cut -d'\/' -f2))\n\t$(eval OUTPUT_NAME := $(APP_NAME)-$(GOOS)-$(GOARCH))\n\t$(eval EXTENSION :=)\n\t@if [ \"$(GOOS)\" = \"windows\" ]; then \\\n\t\tEXTENSION=\".exe\"; \\\n\tfi; \\\n\techo \"Derleniyor: $(GOOS)\/$(GOARCH) -> $(BUILD_DIR)\/$(OUTPUT_NAME)$(EXTENSION)\"; \\\n\tCGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(BUILD_DIR)\/$(OUTPUT_NAME)$(EXTENSION) $(SOURCES)\n\nclean:\n\trm -rf $(BUILD_DIR)<\/code><\/pre>\n<p>Bu Makefile, <code>make<\/code> komutuyla t\u00fcm platformlar i\u00e7in derleme yapman\u0131z\u0131 ve <code>make clean<\/code> ile derlenmi\u015f dosyalar\u0131 temizlemenizi sa\u011flar.<\/p>\n<h4>GoReleaser gibi Ara\u00e7lar<\/h4>\n<p>B\u00fcy\u00fck ve a\u00e7\u0131k kaynakl\u0131 projelerde, platformlar aras\u0131 derleme, s\u0131k\u0131\u015ft\u0131rma, checksum olu\u015fturma ve yay\u0131nlama (GitHub Releases gibi) gibi g\u00f6revleri otomatikle\u015ftirmek i\u00e7in GoReleaser gibi ara\u00e7lar kullan\u0131l\u0131r. GoReleaser, tek bir yap\u0131land\u0131rma dosyas\u0131 ile t\u00fcm bu s\u00fcreci y\u00f6netmenizi sa\u011flar ve CI\/CD (S\u00fcrekli Entegrasyon\/S\u00fcrekli Da\u011f\u0131t\u0131m) boru hatlar\u0131na kolayca entegre edilebilir. Profesyonel projeler i\u00e7in \u015fiddetle tavsiye edilen bir ara\u00e7t\u0131r.<\/p>\n<h4>CI\/CD Entegrasyonu<\/h4>\n<p>Otomatik derleme ve yay\u0131nlama s\u00fcre\u00e7lerini CI\/CD sistemlerine (GitLab CI, GitHub Actions, Jenkins vb.) entegre etmek, yaz\u0131l\u0131m geli\u015ftirme ya\u015fam d\u00f6ng\u00fcs\u00fcn\u00fcn \u00f6nemli bir par\u00e7as\u0131d\u0131r. Go&#8217;nun platformlar aras\u0131 derleme yetene\u011fi, bu entegrasyonu olduk\u00e7a kolayla\u015ft\u0131r\u0131r. Bir CI\/CD pipeline&#8217;\u0131nda, her kod de\u011fi\u015fikli\u011finde yukar\u0131da bahsedilen shell betikleri veya Makefile&#8217;lar \u00e7al\u0131\u015ft\u0131r\u0131larak t\u00fcm hedef platformlar i\u00e7in otomatik olarak \u00e7al\u0131\u015ft\u0131r\u0131labilir dosyalar olu\u015fturulabilir, test edilebilir ve yay\u0131nlanabilir.<\/p>\n<h3>Derlenen Uygulamalar\u0131n Test Edilmesi ve Da\u011f\u0131t\u0131m\u0131<\/h3>\n<p>Uygulamalar\u0131 farkl\u0131 platformlar i\u00e7in derledikten sonra, bunlar\u0131n ger\u00e7ekten beklendi\u011fi gibi \u00e7al\u0131\u015ft\u0131\u011f\u0131ndan emin olmak i\u00e7in test etmek ve ard\u0131ndan kullan\u0131c\u0131lara da\u011f\u0131tmak gerekir.<\/p>\n<h4>Test Stratejileri<\/h4>\n<p>1.  <strong>Hedef Donan\u0131m \u00dczerinde Test:<\/strong> En g\u00fcvenilir y\u00f6ntem, derlenmi\u015f binary&#8217;yi do\u011frudan hedef i\u015fletim sistemi ve donan\u0131m \u00fczerinde \u00e7al\u0131\u015ft\u0131rmakt\u0131r. \u00d6rne\u011fin, Raspberry Pi i\u00e7in derlenmi\u015f bir uygulamay\u0131 ger\u00e7ek bir Raspberry Pi \u00fczerinde test etmek.<br \/>\n2.  <strong>Sanal Makineler (VMs):<\/strong> VMware, VirtualBox, KVM gibi sanal makine yaz\u0131l\u0131mlar\u0131 kullanarak farkl\u0131 i\u015fletim sistemlerinin (Windows, macOS, \u00e7e\u015fitli Linux da\u011f\u0131t\u0131mlar\u0131) sanal \u00f6rneklerini olu\u015fturabilir ve derlenmi\u015f dosyalar\u0131 bu ortamlarda test edebilirsiniz.<br \/>\n3.  <strong>Docker Konteynerleri:<\/strong> Docker, farkl\u0131 Linux da\u011f\u0131t\u0131mlar\u0131 ve hatta farkl\u0131 mimariler (QEMU ile) i\u00e7in izole test ortamlar\u0131 olu\u015fturmak i\u00e7in harika bir ara\u00e7t\u0131r. \u00d6zellikle Linux tabanl\u0131 hedefler i\u00e7in h\u0131zl\u0131 ve hafif test ortamlar\u0131 sa\u011flar.<br \/>\n4.  <strong>Em\u00fclat\u00f6rler (QEMU):<\/strong> QEMU gibi em\u00fclat\u00f6rler, farkl\u0131 CPU mimarilerini (\u00f6rn. ARM) taklit ederek x86\/amd64 makinelerinizde test yapman\u0131za olanak tan\u0131r. Bu, \u00f6zellikle fiziksel donan\u0131ma eri\u015fiminiz olmad\u0131\u011f\u0131nda kullan\u0131\u015fl\u0131d\u0131r.<\/p>\n<h4>Da\u011f\u0131t\u0131m<\/h4>\n<p>\u00c7al\u0131\u015ft\u0131r\u0131labilir dosyalar\u0131 test ettikten sonra, bunlar\u0131 son kullan\u0131c\u0131lara ula\u015ft\u0131rman\u0131z gerekir.<br \/>\n1.  <strong>S\u0131k\u0131\u015ft\u0131rma:<\/strong> \u00c7al\u0131\u015ft\u0131r\u0131labilir dosyalar\u0131 genellikle <code>tar.gz<\/code> (Linux\/macOS i\u00e7in) veya <code>zip<\/code> (Windows i\u00e7in) formatlar\u0131nda s\u0131k\u0131\u015ft\u0131r\u0131r\u0131z. Bu, dosya boyutunu k\u00fc\u00e7\u00fclt\u00fcr ve tek bir paket halinde da\u011f\u0131t\u0131m\u0131 kolayla\u015ft\u0131r\u0131r.<\/p>\n<pre><code class=\"language-bash\">tar -czvf myapp-linux-amd64.tar.gz bin\/myapp-linux-amd64\n    zip myapp-windows-amd64.zip bin\/myapp-windows-amd64.exe<\/code><\/pre>\n<p>2.  <strong>Paket Y\u00f6neticileri:<\/strong> Daha profesyonel da\u011f\u0131t\u0131mlar i\u00e7in, <code>deb<\/code> (Debian\/Ubuntu), <code>rpm<\/code> (Red Hat\/Fedora) gibi paketler olu\u015fturabilir veya homebrew (macOS) gibi paket y\u00f6neticileri i\u00e7in form\u00fcller haz\u0131rlayabilirsiniz. GoReleaser bu konuda da yard\u0131mc\u0131 olabilir.<br \/>\n3.  <strong>GitHub Releases:<\/strong> GitHub&#8217;\u0131n &#8220;Releases&#8221; \u00f6zelli\u011fi, projelerinizin s\u00fcr\u00fcmlerini yay\u0131nlamak ve derlenmi\u015f binary&#8217;leri do\u011frudan kullan\u0131c\u0131lara sunmak i\u00e7in pop\u00fcler bir y\u00f6ntemdir.<br \/>\n4.  <strong>Kendi Y\u00fckleyicileriniz:<\/strong> Baz\u0131 durumlarda, platforma \u00f6zel y\u00fckleyiciler (\u00f6rn. Windows MSI, macOS DMG) olu\u015fturman\u0131z gerekebilir.<\/p>\n<h3>S\u0131k Kar\u015f\u0131la\u015f\u0131lan Sorunlar ve \u00c7\u00f6z\u00fcmleri<\/h3>\n<p>Platformlar aras\u0131 derleme genellikle sorunsuz olsa da, baz\u0131 yayg\u0131n sorunlarla kar\u015f\u0131la\u015fabilirsiniz:<\/p>\n<p>1.  <strong><code>CGO_ENABLED=0<\/code> Hatas\u0131 veya Ba\u011f\u0131ml\u0131l\u0131k Sorunlar\u0131:<\/strong><br \/>\n    *   <strong>Sorun:<\/strong> <code>CGO_ENABLED=0<\/code> ile derleme yaparken &#8220;undefined reference to&#8230;&#8221; veya benzeri hatalar al\u0131yorsunuz. Bu, kodunuzun dolayl\u0131 olarak C k\u00fct\u00fcphanelerine ba\u011f\u0131ml\u0131 oldu\u011fu anlam\u0131na gelir.<br \/>\n    *   <strong>\u00c7\u00f6z\u00fcm:<\/strong> Go&#8217;nun saf Go implementasyonlar\u0131n\u0131 kullanmaya \u00e7al\u0131\u015f\u0131n. \u00d6rne\u011fin, <code>github.com\/mattn\/go-sqlite3<\/code> yerine <code>github.com\/glebarez\/go-sqlite<\/code> gibi saf Go tabanl\u0131 bir SQLite s\u00fcr\u00fcc\u00fcs\u00fc kullan\u0131n. E\u011fer bir k\u00fct\u00fcphane ka\u00e7\u0131n\u0131lmaz olarak <code>cgo<\/code> gerektiriyorsa, ya hedef platform i\u00e7in bir cross-C derleyicisi kurup <code>CGO_ENABLED=1<\/code> ile derlemeyi deneyin ya da alternatif bir k\u00fct\u00fcphane aray\u0131n.<\/p>\n<p>2.  <strong>Yanl\u0131\u015f <code>GOOS<\/code>\/<code>GOARCH<\/code> Kombinasyonlar\u0131:<\/strong><br \/>\n    *   <strong>Sorun:<\/strong> Derlenen binary hedef sistemde \u00e7al\u0131\u015fm\u0131yor veya &#8220;bad ELF interpreter&#8221; gibi hatalar veriyor.<br \/>\n    *   <strong>\u00c7\u00f6z\u00fcm:<\/strong> <code>GOOS<\/code> ve <code>GOARCH<\/code> de\u011fi\u015fkenlerinin hedef sistemle tam olarak e\u015fle\u015fti\u011finden emin olun. \u00d6zellikle 32-bit\/64-bit (<code>386<\/code> vs <code>amd64<\/code>, <code>arm<\/code> vs <code>arm64<\/code>) ve ARM versiyonlar\u0131 (<code>GOARM<\/code>) konusunda dikkatli olun. <code>file<\/code> komutu (Linux\/macOS) ile binary&#8217;nin mimarisini kontrol edebilirsiniz: <code>file myapp-linux-arm<\/code>.<\/p>\n<p>3.  <strong>\u0130zin Sorunlar\u0131:<\/strong><br \/>\n    *   <strong>Sorun:<\/strong> Linux veya macOS&#8217;ta derlenmi\u015f bir binary&#8217;yi \u00e7al\u0131\u015ft\u0131r\u0131rken &#8220;Permission denied&#8221; hatas\u0131 al\u0131yorsunuz.<br \/>\n    *   <strong>\u00c7\u00f6z\u00fcm:<\/strong> \u00c7al\u0131\u015ft\u0131r\u0131labilir dosyaya \u00e7al\u0131\u015ft\u0131rma izni verin: <code>chmod +x myapp-linux-amd64<\/code>.<\/p>\n<p>4.  <strong>Derleme \u00c7\u0131kt\u0131s\u0131n\u0131n Hedeflenen Platformda \u00c7al\u0131\u015fmamas\u0131:<\/strong><br \/>\n    *   <strong>Sorun:<\/strong> Binary derleniyor ancak hedef sistemde beklenmedik hatalar veriyor veya hi\u00e7 ba\u015flam\u0131yor.<br \/>\n    *   <strong>\u00c7\u00f6z\u00fcm:<\/strong><br \/>\n        *   <strong>Ba\u011f\u0131ml\u0131l\u0131klar:<\/strong> Go binary&#8217;leri genellikle statik olsa da, baz\u0131 durumlarda (\u00f6zellikle <code>CGO_ENABLED=1<\/code> ile derlenmi\u015fse) hedef sistemde belirli dinamik k\u00fct\u00fcphanelerin bulunmas\u0131 gerekebilir.<br \/>\n        *   <strong>S\u00fcr\u00fcm Uyumsuzlu\u011fu:<\/strong> Go s\u00fcr\u00fcm\u00fcn\u00fcz\u00fcn ve hedef platformun uyumlu oldu\u011fundan emin olun. \u00c7ok eski i\u015fletim sistemleri, modern Go binary&#8217;lerini \u00e7al\u0131\u015ft\u0131rmakta zorlanabilir.<br \/>\n        *   <strong>Debugging:<\/strong> Hedef sistemde uygulaman\u0131n neden \u00e7al\u0131\u015fmad\u0131\u011f\u0131n\u0131 anlamak i\u00e7in hata ay\u0131klama ara\u00e7lar\u0131n\u0131 (\u00f6rne\u011fin, Linux&#8217;ta <code>strace<\/code> veya <code>ldd<\/code>) kullan\u0131n.<\/p>\n<h3>Sonu\u00e7<\/h3>\n<p>Go&#8217;nun platformlar aras\u0131 derleme yetene\u011fi, dilin en g\u00fc\u00e7l\u00fc ve takdir edilen \u00f6zelliklerinden biridir. Tek bir komutla, kod taban\u0131n\u0131zdan birden fazla i\u015fletim sistemi ve mimari i\u00e7in optimize edilmi\u015f, ba\u011f\u0131ms\u0131z \u00e7al\u0131\u015ft\u0131r\u0131labilir dosyalar olu\u015fturabilirsiniz. Bu, geli\u015ftiricilere b\u00fcy\u00fck bir esneklik sa\u011flar, da\u011f\u0131t\u0131m s\u00fcre\u00e7lerini basitle\u015ftirir ve CI\/CD boru hatlar\u0131na kolay entegrasyon imkan\u0131 sunar.<\/p>\n<p>Ubuntu 16.04 gibi bir geli\u015ftirme ortam\u0131nda Go&#8217;nun bu yetene\u011fini kullanmak, projelerinizi geni\u015f bir kullan\u0131c\u0131 kitlesine ula\u015ft\u0131rman\u0131n kap\u0131lar\u0131n\u0131 a\u00e7ar. <code>GOOS<\/code> ve <code>GOARCH<\/code> ortam de\u011fi\u015fkenlerini do\u011fru bir \u015fekilde kullanarak, <code>CGO_ENABLED=0<\/code> ile statik binary&#8217;ler \u00fcreterek ve shell betikleri veya Makefile&#8217;lar gibi otomasyon ara\u00e7lar\u0131n\u0131 kullanarak, platformlar aras\u0131 derleme s\u00fcrecini verimli bir \u015fekilde y\u00f6netebilirsiniz. Go&#8217;nun bu \u00f6zelli\u011fi, modern yaz\u0131l\u0131m geli\u015ftirme d\u00fcnyas\u0131nda rekabet avantaj\u0131 sa\u011flayan kritik bir yetenektir.<\/body><\/p>\n","protected":false},"excerpt":{"rendered":"Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi\nGiri\u015f\nGo (Golang), Google taraf\u0131ndan geli\u015ftirilen modern,","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_page_header_type":"","csco_page_load_nextpost":"","csco_page_subscribe_form":"","csco_page_contact_form":"","footnotes":""},"categories":[1468],"tags":[],"class_list":{"0":"post-39132","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-ubuntu","7":"cs-entry","8":"cs-video-wrap"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.5 (Yoast SEO v25.3.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi\" \/>\n<meta property=\"og:description\" content=\"Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi Giri\u015f Go (Golang), Google taraf\u0131ndan geli\u015ftirilen modern,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/\" \/>\n<meta property=\"og:site_name\" content=\"Kodlar\u0131n Gizemli D\u00fcnyas\u0131\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-15T01:40:47+00:00\" \/>\n<meta name=\"author\" content=\"Fatih Soysal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Yazan:\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fatih Soysal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data2\" content=\"18 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/\"},\"author\":{\"name\":\"Fatih Soysal\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"headline\":\"Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi\",\"datePublished\":\"2026-02-15T01:40:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/\"},\"wordCount\":2998,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"articleSection\":[\"Ubuntu\"],\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/#respond\"]}],\"copyrightYear\":\"2026\",\"copyrightHolder\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/\",\"name\":\"Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\"},\"datePublished\":\"2026-02-15T01:40:47+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Anasayfa\",\"item\":\"https:\/\/fatihsoysal.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/\",\"name\":\"Fatihsoysal.com\",\"description\":\"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim\",\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"tr\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\",\"name\":\"Fatih Soysal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"tr\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"contentUrl\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"width\":512,\"height\":512,\"caption\":\"Fatih Soysal\"},\"logo\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/","og_locale":"tr_TR","og_type":"article","og_title":"Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi","og_description":"Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi Giri\u015f Go (Golang), Google taraf\u0131ndan geli\u015ftirilen modern,","og_url":"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/","og_site_name":"Kodlar\u0131n Gizemli D\u00fcnyas\u0131","article_published_time":"2026-02-15T01:40:47+00:00","author":"Fatih Soysal","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"Fatih Soysal","Tahmini okuma s\u00fcresi":"18 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/#article","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/"},"author":{"name":"Fatih Soysal","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"headline":"Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi","datePublished":"2026-02-15T01:40:47+00:00","mainEntityOfPage":{"@id":"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/"},"wordCount":2998,"commentCount":0,"publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"articleSection":["Ubuntu"],"inLanguage":"tr","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/#respond"]}],"copyrightYear":"2026","copyrightHolder":{"@id":"https:\/\/fatihsoysal.com\/blog\/#organization"}},{"@type":"WebPage","@id":"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/","url":"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/","name":"Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/#website"},"datePublished":"2026-02-15T01:40:47+00:00","breadcrumb":{"@id":"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/fatihsoysal.com\/blog\/ubuntu-16-04-uzerinde-go-uygulamalarini-farkli-platformlar-icin-olusturma-rehberi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Anasayfa","item":"https:\/\/fatihsoysal.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Ubuntu 16.04 \u00dczerinde Go Uygulamalar\u0131n\u0131 Farkl\u0131 Platformlar \u0130\u00e7in Olu\u015fturma Rehberi"}]},{"@type":"WebSite","@id":"https:\/\/fatihsoysal.com\/blog\/#website","url":"https:\/\/fatihsoysal.com\/blog\/","name":"Fatihsoysal.com","description":"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim","publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"tr"},{"@type":["Person","Organization"],"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1","name":"Fatih Soysal","image":{"@type":"ImageObject","inLanguage":"tr","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","contentUrl":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","width":512,"height":512,"caption":"Fatih Soysal"},"logo":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/"},"description":"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.","url":"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/"}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/39132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/comments?post=39132"}],"version-history":[{"count":1,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/39132\/revisions"}],"predecessor-version":[{"id":39133,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/39132\/revisions\/39133"}],"wp:attachment":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/media?parent=39132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/categories?post=39132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/tags?post=39132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}