Posts

INSTALL GOLANG IN CENTOS 7

 install vernemq in centos Step 1)  Download the binary exe (Refer https://vernemq.com/downloads/index.html) here, for CentOS 7 :  sudo wget https://github.com/vernemq/vernemq/releases/download/1.12.4/vernemq-1.12.4.centos7.x86_64.rpm Step 2) Install the rpm file downloaded sudo yum install vernemq-1.12.4.centos7.x86_64.rpm  3) Accept the EULA  sudo vi /etc/vernemq/vernemq.conf  Make  "accept_eula" =yes  Making accept_eula=yes allows us say yes to the End User Licence Agreement (EULA) 4) Start vernemq sudo service vernemq start 5) Check if vernemq is installed successfuly rpm -qa | grep vernemq This returns the vernemq being installed in the system ---------------------------------------------------------------------------------------------------------------

INSTALL GIT IN CENTOS 7

Step 1: From your home directory in CentOS , type  cd /usr/src  Step 2: Copy these commands to download the git tar sudo wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.29.0.tar.gz  sudo tar xzf git-2.29.0.tar.gz Step 3: Install the following dependencies : sudo yum -y install gcc sudo yum install --assumeyes openssl-devel sudo yum install libcurl-devel yum install expat-devel Step 4:  cd git-2.29.0  sudo make prefix=/usr/local/git all  sudo make prefix=/usr/local/git install  Step 5:  Open your /etc/bashrc and add the following            export PATH=/usr/local/git/bin:$PATH Then type             source /etc/bashrc Step 6: Check if git is installed by typing and checking             git version horray check git version

GITHUB - Creating a Repo

     HOW TO MAKE A GIT REPO INTO AN ORDINARY FOLDER 1) Simple : Remove the .git file inside the folder 2) Use ls -a to view the hidden files 3) Remove it using sudo rm -rf .git 4) Hooray, it's no more a git repo. Time to Smile HOW TO MAKE A FOLDER INTO A GIT REPO FROM COMMAND PROMPT 0)Create a repo in your github page : Top right corner "+". Give name, public/private, create a README file and give create. Check under "CODE" - the place where we clone the project check for the url under https ending with .git 1)In the command prompt, go to the directory for which you want to create the repo For Example : If Sample is the repo, let your command prompt be     Sample$ 2) Use the command      git init 3) Type the command      git add . 4) Type the command           git commit -m "first commit" 5) Type the command           git remote add origin your_git_url_that_you_can_copy_from_git_with_.git 6)Type this      git push -u origin master 7) Make mast

Find go version?

 Find go version :Type  go version Print environment variables in linux printenv GOROOT is a variable that defines where your Go SDK is located.In my computer /usr/local/go. You do not need to change this variable, unless you plan to use different Go versions.   GOPATH is the root of your workspace and contains the following folders: src/ : location of Go source code (for example, .go , .c , .g , .s ). pkg/ : location of compiled package code (for example, .a ). bin/ : location of compiled executable programs built by Go. How to find GOPATH and GOROOT in your system? go env GOROOT go env GOPATH GOPATH is used to resolve import statements If the environment variable is unset, GOPATH defaults to a subdirectory named “go” in the user’s home directory. To check this, enter the following command: On Linux: $go env GOPATH   $HOME/go When using modules in Go, the GOPATH is no longer used to determine imports. However, it is still used to store downloaded source code in pkg

Go : Why 'main' function and why 'main' package

  In Go, the entry point for any application is the main function in the main package. Program execution begins by initializing the main package and then invoking the function main. Your application must have a package named main and declare a function main that takes no arguments and returns no value.  package main  func main () { … }