{
  "slug": "My-first-application-development-with-Golang-as-a-PHP-developer--9c31e37903b8",
  "title": "My first application development with Golang as a PHP developer.",
  "subtitle": "after I’m facing CPU usage in PHP and Laravael framework I decided to implement my data engineer system by Go language.",
  "excerpt": "after I’m facing CPU usage in PHP and Laravael framework I decided to implement my data engineer system by Go language.",
  "date": "2021-02-07",
  "tags": [
    "My Experience",
    "Go",
    "PHP",
    "Data Engineering"
  ],
  "readingTime": "2 min",
  "url": "https://medium.com/@mobinshaterian/my-first-application-development-with-golang-as-a-php-developer-9c31e37903b8",
  "hero": "https://cdn-images-1.medium.com/max/800/1*1_AsY_DTrHOrTTCM0uWB3w.png",
  "content": [
    {
      "type": "paragraph",
      "html": "after I’m facing CPU usage in PHP and Laravael framework I decided to implement my data engineer system by Go language."
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*1_AsY_DTrHOrTTCM0uWB3w.png",
      "alt": "PHP application using all cores",
      "caption": "PHP application using all cores",
      "width": 1537,
      "height": 804
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Install GO"
    },
    {
      "type": "paragraph",
      "html": "it’s very simple and nice document that install Go on the official page"
    },
    {
      "type": "paragraph",
      "html": "<a href=\"https://golang.org/doc/install\" target=\"_blank\" rel=\"noreferrer noopener\">https://golang.org/doc/install</a>"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Set environment"
    },
    {
      "type": "paragraph",
      "html": "set env always making problem."
    },
    {
      "type": "code",
      "lang": "javascript",
      "code": "export PATH=$PATH:/usr/local/go/bin"
    },
    {
      "type": "paragraph",
      "html": "easy way to set up ENV is using the go command"
    },
    {
      "type": "code",
      "lang": "text",
      "code": "go env"
    },
    {
      "type": "paragraph",
      "html": "it looks like to add adding a folder of the vendor ( PHP ) in the home directory"
    },
    {
      "type": "code",
      "lang": "javascript",
      "code": "export PATH=$PATH:/usr/local/go/bin"
    },
    {
      "type": "code",
      "lang": "javascript",
      "code": "export GOPATH=$HOME/go"
    },
    {
      "type": "paragraph",
      "html": "unlike Laravel, Goland set library in GOPATH place"
    },
    {
      "type": "paragraph",
      "html": "if using Goland IDE set env like the picture below."
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*DEkPRvllmnlrXRDq8MhGHg.png",
      "alt": "My first application development with Golang as a PHP developer.",
      "caption": "",
      "width": 562,
      "height": 405
    },
    {
      "type": "paragraph",
      "html": "Uncheck use GOPATH that’s defined in system env"
    },
    {
      "type": "paragraph",
      "html": "Index entire GOPATH"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Forget composer"
    },
    {
      "type": "paragraph",
      "html": "I have never seen something like this before"
    },
    {
      "type": "paragraph",
      "html": "if you want to download a file from GitHub or another online source it’s just imported directly from Github."
    },
    {
      "type": "code",
      "lang": "go",
      "code": "import \"github.com/dgrijalva/jwt-go\""
    },
    {
      "type": "paragraph",
      "html": "just only need to write import source src. that’s it. go download it to GOPATH and you can use the repository immediately."
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Small and Fast"
    },
    {
      "type": "paragraph",
      "html": "Php has a huge library and a very big Framework to build the system in another way Golang is smaller and faster than Php."
    },
    {
      "type": "paragraph",
      "html": "I’m not recommending using pure PHP anyway because it’s not secure and has a lot of problems and every PHP developer must using a framework but in Goland we have a different story. Goland has lots of ability in its language and has small framework."
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Compiler in web"
    },
    {
      "type": "paragraph",
      "html": "I’m writing CPP code many years ago and still believe the best and fastest language in the world is c and CPP but as a web developer I can’t using these languages for web development but Goland is something to write website with CPP and it’s very interesting."
    },
    {
      "type": "paragraph",
      "html": "compile and build a website as a&nbsp;.exe file or executable file in Linux. I know docker can encapsulate software but something like this is very cool."
    },
    {
      "type": "heading",
      "level": 2,
      "text": "no classes only struct"
    },
    {
      "type": "paragraph",
      "html": "Golang’s purpose is to simplify and fast everything so it removes some class futures. I think using java for enterprise systems has the best performance than Golang and Goland only using as fast response or data engineer tools but Java is a more suitable language for an enterprise system."
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Pointer"
    },
    {
      "type": "paragraph",
      "html": "yes, it’s come back to web development language. PHP developer scare from pointer but Goland give handling pointer to the developer."
    },
    {
      "type": "heading",
      "level": 2,
      "text": "where using GO"
    },
    {
      "type": "paragraph",
      "html": "if the website has a million users or wants to make a data engineer pipeline I strongly recommend using Go. but if a business owner wants to make MVP or just testing market PHP is the best solution."
    }
  ]
}