Skip to main content

Go setup on Linux and write First Program in Go

Easy Installation Of Go On Linux


1.Open terminal and add a command: go first Download directory
cd/Download then type a command:
wget -c https://storage.googleapis.com/golang/go1.9.1.linux-amd64.tar.gz to download a go for linux.
1.9.1 is latest version of go now.

2.then extract it using : 
sudo tar -C /usr/local -xvzf go1.9.1.linux-amd64.tar.gz 

3.then create your own go project directory with bin,src,pkg using:
mkdir -p ~/go_projects/{bin,src,pkg} 

4. cd/go_projects  
5.export  PATH=$PATH:/usr/local/go/bin
6. export GOPATH="$HOME/go_projects"
7. export GOBIN="$GOPATH/bin"
8.source ~/.profile
9.to checked using type go version:your output like: 
 go version go1.9.1 linux/amd64 
10.then go env : output is
  1. GOARCH="amd64"
    GOBIN="/root/go_projects/bin"
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/root/go_projects"
    GORACE=""
    GOROOT="/usr/local/go"
    GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
    GCCGO="gccgo"
    CC="gcc"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build215970517=/tmp/go-build -gno-record-gcc-switches"
    CXX="g++"
    CGO_ENABLED="1"
    CGO_CFLAGS="-g -O2"
    CGO_CPPFLAGS=""
    CGO_CXXFLAGS="-g -O2"
    CGO_FFLAGS="-g -O2"
    CGO_LDFLAGS="-g -O2"
    PKG_CONFIG="pkg-config"
 11.then create home named directory in src folder of go_projects like mkdir -p ~/go_projects/src/hello
 12.then Create and  run our first program :
  1. package main
    import "fmt"
    func main() {
    fmt.Printf("Hello,Gaurav Bole welcome in GoLang\n")
    }
 13.saved as a hello.go 
14. then run this program - go to directory of hello.go file then run a command 
15. go run hello.go  
16. and finally we get a output like :Hello,Gaurav Bole welcome in GoLang

Comments

Popular posts from this blog

>>list_numbers = [12,6,8,78] >>list_numbers[::-1] [78, 8, 6, 12] # Reverse a List >>list_numbers[-1:] [78] >>list_numbers[:-1] [12, 6, 8] #Remove a last number >>list_numbers[-1::] [78] >>list_numbers[-2::] [8, 78] # Last Two Element >>list_numbers[:-2] [12, 6] ########################################### Two List match one to end list_b = [5, 6, 7, 8,34] list_a = [1, 2, 3, 4, 90,80] c = map(lambda x,y:[x,y],list_a,list_b) for i in c:     print(i)

My First Game Application.........

APK file Link

CHat Bot In java

package com.gaurav.bole; import java.awt.Color; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.Scrollable; public class ChatBoot extends JFrame implements KeyListener {  JPanel p=new JPanel();  JTextArea dilog=new JTextArea(20,50);  JTextArea input= new JTextArea(1,50);  JScrollPane scroll= new JScrollPane(dilog,    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED    );  String[][] chatBot={    //standerds greeting    {"hi","hell","him"},    {"hi","hello","hey"},    //question    {"how r u","how are you","how are u","how r you"},    {"good","doing well","ya i am ok"},    //..........    {"sut up","you're b...