Hi guys, i've miss all of you, COVID-19 existing anywhere and don't know when it gone. I've troubling work-life balance then no new thread for long time again, so sad but yeah! i'm here right now.
Go in general word but we're talking about programming language, if you're not familiar with it you can try here Golang, it's powerful programming language that you can learn without install anything from their site. This tutorial from my style is local machine then you'll get how to installation and setup for MacOS platform as sample. You can try other platform too. because we're following from their instruction in simple way and a few description as a must.
Installation and Setup
Let's start, first of all you must have Go on your machine, open this site https://golang.org/dl/ and take a look under section Featured Downloads pick the right one for your OS. For me using MacOS. After done download double click PKG file.
The installer and description appear, just click Continue.
Check your disk space before Continue, it's telling you how much totally size of installation required on your machine.
The default location provided as admin or root path of your machine, you can change it but i recommended leave it as default and just click Install.
An admin or root will ask you to allow permission to install this software by input admin name and password and then click Install Software.
Waiting until finished installation then click Close. Next you must setup environment to Go for compile and execute your program. Then open command line, for me is Terminal as MacOS. and type sudo nano -e ~/.bash_profile then hit Enter.
Put the line of export PATH=$PATH:/usr/local/go/bin in your .bash_profile file if you've change installation path the path should be difference then Ctrl+X it's asking you to confirm your change, just type Y and hit Enter. Then quit Terminal **the setup will affect only fresh open Terminal then this is required to do it.
Now, launch Terminal again and type go version and hit Enter, you'll see go version go1.15 darwin/amd64. This mean your setup and installation for Go is done. Btw you should try create small program, then compile and execute to prove it work at all.
Create Hello, world
Choose your text editor, may be notepad++, visual studio, visual studio code, sublime or etc, anyway it's fine for beginner. I've use visual studio code, create new file and type below.
package main
import "fmt"
func main() {
fmt.Printf("Hello, world\n")
}
Then save your file as hello.go on somewhere easier to locate from command line, for me i've created GolangMobile folder on Desktop then open Terminal and type cd Desktop/GolangMobile/ and hit Enter. Next, check is hello.go exist or not by type ls then hit Enter.
Next, compile your
hello.go by type command
go build hello.go and hit
Enter. if your program is nothing wrong it's just show new line of command prompt, that's it.
Now, you should have execute file, let's type
ls then hit
Enter, you'll see another
hello file but no .go extension, like this.
One last thing, try run your first hello program by type ./hello then hit Enter.
Hooray!!, your first
Hello, world now show on your command line. I need to take a rest now to prepare
Part 2 that will teach you how to
Setup and Installation Go for mobile and launch first mobile app from example both Android and iOS.
Thank you so much for visit this blog. See U next thread. :)
No Like, No Thumbs Up, No Bell, Please support me by click any interested sponsor, thank you...
Comments
Post a Comment