Coder Social home page Coder Social logo

golangbasics's Introduction

What is this project?

This project is just a simple Go Project that displays the syntax that I can go back to later as a reference

Tutorial Used

https://app.pluralsight.com/library/courses/go-fundamentals/table-of-contents

Install Go

https://go.dev/doc/install?download

How to create & run a Go program

  1. Creating your first module, you will run this command:
    • go mod init {name}
      • The name can be anything, but if you plan on publishing this module, then it should be the url path to where your versioning control is.
      • Example: go mod init github.com/jakedansoncyber/GoLangHelloWorld
      • Note, do not include https://
  2. Whichever folder you run this command in, this is now the module. Any folders below this folder are what will be called packages.
  3. Write code:
    • I created a file called hello.go inside of the HelloWorld folder. This hello.go specifies that it is an application and will be ran as an application.
  4. Now we can run our code. But here are three different options we can choose from:
    • Run: Go compiled the app into a temp directory, ran it and then cleaned it up after it was done.
    • Build: Creates an executable with the name of the package that you created it in. If I said "go build .", my executable would be named HelloWorld in this case.
    • Install: Installs it locally in the go/bin folder
    • For simplicity, we will just run the command: go run .
      • Make sure you are in the folder that your application lies in. This command will run any go application in the current directory.

golangbasics's People

Contributors

jakedansoncyber avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.