goprogramming

module
v0.0.0-...-d958962 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2022 License: MIT

README

Go (programming language)

Go (often referred to as golang) is a programming language created at Google in 2009 by Robert Griesemer, Rob Pike, and Ken Thompson. It is a compiled, statically typed language in the tradition of Algol and C, with garbage collection, limited structural typing, memory safety features and CSP-style concurrent programming features added. The compiler and other language tools originally developed by Google are all free and open source. (Wiki)

stack Overflow

Golang Highlights

01. Compiled
02. Performant
03. Multiple-cores
04. Concurrency
05. Network
06. Statically typed language in the tradition of Algol and C
07. With garbage collection
08. Limited structural typing
09. Memory safety features
10. CSP-style concurrent programming
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

How to run in Windows

  1. First download GO windows installer
    https://golang.org/dl/

  2. For editor i suggest VS code. If you already dont have it please download overe here,
    https://code.visualstudio.com/download

  3. Go lang VS code market place,
    https://marketplace.visualstudio.com/items?itemName=lukehoban.Go

  4. How to Go programming in VS Code,
    https://code.visualstudio.com/docs/languages/go

Hello World code:

package main

import "fmt"

func main() {
fmt.Println("Hello, World!")
}

Run from VS code,

A. Go to VS code terminal (View-->Integrated Terminal)
B. Tyep,cd "your test.go file loc"
Ex: cd E:\GOWP
C. Then type go run test.go

stack Overflow

VS Code Editor Command

  1. Format your Go file using Shift+Alt+F
  2. Go To Definition F12 - Go to the source code of the type definition.
  3. Peek Definition Alt+F12 - Bring up a Peek window with the type definition.
  4. Find All References Shift+F12 - Find all references for the type.

Top Go Web Frameworks

A list of popular github projects related to Go web framework (ranked by stars automatically) Please update list.txt (via Pull Request)

Project Name Stars Forks Open Issues Description
gin 15881 1853 208 Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.
beego 14575 3196 454 beego is an open-source, high-performance web framework for the Go programming language.
martini 10003 1049 1 ⚠️ No longer maintained ⚠️ Classy web framework for Go
echo 9799 834 102 High performance, minimalist Go web framework
iris 9649 978 5 The fastest web framework for Go on (THIS) Earth
revel 9621 1228 65 A high productivity, full-stack web framework for the Go language.
kit 9461 955 45 A standard library for microservices.
httprouter 6655 666 53 A high performance HTTP request router that scales well
fasthttp 5926 519 152 Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http
mux 5691 724 20 A powerful URL router and dispatcher for golang.
chi 3296 231 14 lightweight, idiomatic and composable router for building Go HTTP services
go-json-rest 3063 330 41 A quick and easy way to setup a RESTful JSON API
goa 2679 268 34 Design-based APIs and microservices in Go
go-restful 2602 400 7 package for building REST-style Web Services using Google Go
buffalo 2517 190 47 Rapid Web Development w/ Go
macaron 2277 215 12 Package macaron is a high productive and modular web framework in Go.
gizmo 2135 130 8 A Microservice Toolkit from The New York Times
go-swagger 2076 389 227 Swagger 2.0 implementation for go
armor 1344 42 11 Uncomplicated, modern HTTP server
web 1297 99 17 Go Router + Middleware. Your Contexts.
dotweb 815 122 9 Simple and easy go web micro framework
tango 700 104 9 Micro & pluggable web framework for Go
rest-layer 642 47 35 REST Layer, Go (golang) REST API framework
goji 616 44 3 Goji is a minimalistic and flexible HTTP request multiplexer for Go (golang)
traffic 515 26 0 Sinatra inspired regexp/pattern mux and web framework for Go [NOT MAINTAINED]
neo 357 35 5 Go Web Framework
aegis 140 5 5 Serverless Golang APIs with AWS Lambda & API Gateway
gorest 27 1 2 Tideland GoREST
webgo 22 2 2 A very lightweight & simple web framework for Go

The major differences between Java and Golang are:

  1. Go’s compilation speed is very fast as no VM is needed to execute Go program.
  2. Go can return more than one value whereas Java can’t. Every time you need to create object as there is no pointer support in Java.
  3. Garbage collection is pretty good in Golang.
  4. Golang have goroutine in order to achieve multitasking.
  5. A single thread in java takes more than 1 MB memory on heap whereas goroutine takes approx. 2 KB.
  6. You need to extend class from Thread class or implements Runnable interface and need to put your logic in run() in java , but in Golang you just need to write go keyword before function definition so it will make that function as goroutine.
  7. Also synchronization support is very good in golang.
  8. Go’s interface is more flexible as there is no support for inheritance. Inheritance makes things more complex in bigger projects.
VS code debugging:

https://github.com/Microsoft/vscode-go
https://github.com/derekparker/delve/tree/master/Documentation/installation
https://github.com/derekparker/delve/blob/master/Documentation/installation/windows/install.md
go get -u github.com/derekparker/delve/cmd/dlv

https://www.jetbrains.com/go/
VS Code
Web Strome

SQLDrivers

https://github.com/golang/go/wiki/SQLDrivers

A pure Go MSSQL driver for Go's database/sql package

https://github.com/denisenkom/go-mssqldb
cmd: go get github.com/denisenkom/go-mssqldb

Go MySQL Driver

https://github.com/go-sql-driver/mysql/
cmd: go get -u github.com/go-sql-driver/mysql

Graphical comparison of GO language with other languages

stack Overflow

stack Overflow

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL