Coder Social home page Coder Social logo

learning-go's Introduction

learning-go

Code written while learning go

Basic Commands

- go mod init {{file name}}
- go env

Helpful tips

- new() vs make()
    - new() allocates memory but does not initialize whereas make() allocates memory and intializes
    - new creates zeroed storage( cannot put data) whereas make() gives non zeroed stoage.

Useful inbuilt Packages

  • bufio package is for taking input (refer 03 and 04)
  • strconv packages helps with converting string
  • strings package helps working with strings
  • time package
  • sync package
  • Mutex

Things to remember

- file with the main function needs to start have `package main` at top
- public variables start in capital letters, private ones start in lower
- nil is the syntax for null value
- formatting time : ```go 01-02-2006 15:04:05 Monday```
- Pointer is a direct reference to memory location. using this ensures original value is being transferred and not a copy
- array is not a commonly used data type in this. Slice is what is dominantly used
- ranges in slice, the last range are non-inclusive
- You need to encode and decode jsons for APIs. If you are creating a JSON you need to encode, if you are recieving a json you need to decode it. Use the json(inbuilt) library
- Forgot what context is. Need to look into that again

semvar.org(semvar.org)

Libraries:

- Routing : Gorilla Mux `go get -u github.com/gorilla/mux`
- MongoDB Driver: `go get go.mongodb.org/mongo-driver/mongo`

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.