{"id":18742920,"url":"https://github.com/amreshpro/go","last_synced_at":"2026-05-19T14:06:39.579Z","repository":{"id":221849725,"uuid":"755546010","full_name":"amreshpro/go","owner":"amreshpro","description":"Go: A statically typed language that delivers simplicity, speed, and powerful concurrency for building scalable applications effortlessly.","archived":false,"fork":false,"pushed_at":"2025-02-27T18:15:37.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T12:03:38.928Z","etag":null,"topics":["gin-gonic","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amreshpro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-10T14:45:13.000Z","updated_at":"2025-02-27T18:15:41.000Z","dependencies_parsed_at":"2024-02-10T15:42:47.339Z","dependency_job_id":"84590641-5117-45c2-be32-d12fa223f150","html_url":"https://github.com/amreshpro/go","commit_stats":null,"previous_names":["amreshpro/go"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amreshpro/go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amreshpro%2Fgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amreshpro%2Fgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amreshpro%2Fgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amreshpro%2Fgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amreshpro","download_url":"https://codeload.github.com/amreshpro/go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amreshpro%2Fgo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33219423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-19T07:54:09.561Z","status":"ssl_error","status_checked_at":"2026-05-19T07:54:08.508Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gin-gonic","go","golang"],"created_at":"2024-11-07T16:09:35.947Z","updated_at":"2026-05-19T14:06:39.545Z","avatar_url":"https://github.com/amreshpro.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n---\n\n# Go Language Notes\n\n### 5 Reasons to Choose Go (Golang)\n\n1. **Build Time** – Fast build times due to its efficient compilation process.\n2. **Fast Startup** – Instant start-up times, making it great for quick server responses.\n3. **Performance and Efficiency** – Combines the efficiency of a statically typed, compiled language with the simplicity of dynamic languages.\n4. **Concurrency Model** – Goroutines provide lightweight, easy-to-use concurrency.\n5. **Strong Typing and Compilation** – Static typing and a strong type system ensure type safety and prevent many bugs during compile time.\n\n### Why Go is Great (Go Pros)\n\n- **Statically Typed** – Type checks during compile time, improving reliability.\n- **Fast Run Time** – Compiled to machine code, providing near C-level performance.\n- **Compiled Language** – Ensures faster performance and safety as the code runs directly on the hardware.\n- **Fast Compilation** – Go has one of the fastest compilation times among modern languages.\n- **Concurrency Support** – Through goroutines and channels, Go handles multiple tasks simultaneously.\n- **Automatic Garbage Collection** – Simplifies memory management by cleaning up unused memory.\n- **No Classes \u0026 Objects** – Object-oriented paradigms are simplified, no inheritance is used, focusing on composition over inheritance.\n\n---\n\n### Common Go Commands\n\nHere are some frequently used Go commands:\n\n- `pkg` – Package management.\n- `bin` – Binary directory for compiled Go programs.\n- `src` – Source directory for Go code.\n\nOther important commands include:\n\n- `go --help` – Show command options.\n- `bug` – Opens a browser to report bugs.\n- `build` – Compile the package and dependencies.\n- `clean` – Remove object and cached files.\n- `doc` – Show documentation for packages.\n- `env` – Print Go environment information.\n- `fix` – Update packages to use new APIs.\n- `fmt` – Format Go code (automatically adjusts indentation, spacing).\n- `generate` – Generate Go files based on source code.\n- `get` – Add and install dependencies.\n- `install` – Install package dependencies.\n- `list` – List packages or modules.\n- `mod` – Manage Go modules (dependencies).\n- `run` – Compile and run Go program.\n- `test` – Run unit tests for packages.\n- `version` – Print Go version.\n- `vet` – Report suspicious constructs that could be bugs.\n\n---\n\n### Go Keywords\n\nGo language reserves the following keywords:\n\n```go\npackage, break, default, func, interface, select, \ncase, defer, go, map, delete, struct, \nchan, if, else, goto, package, switch, \nconst, var, for, fallthrough, range, type, \ncontinue, import, return\n```\n\n---\n\n### Writing Your First Go Program\n\nExample: `first.go`\n\n```go\npackage main\nimport \"fmt\"\n\nfunc main() {\n    fmt.Println(\"Hello Golang\")\n}\n```\n\n**Explanation:**\n\n- **fmt.Println** – This prints the output. In this case, it prints \"Hello Golang\".\n- Statements in Go are separated by either pressing \"Enter\" or by using a semicolon (`;`). However, Go automatically adds semicolons when you hit \"Enter\".\n\n\u003e **Note:** The `{` must be on the same line as the function declaration. For example:\n\n```go\nfunc main() // error if `{` is on a new line\n{\n  fmt.Println(\"Hello Golang\")\n}\n```\n\n---\n\n### Variable Declaration in Go\n\nGo provides two ways to declare variables:\n\n1. **Using `var`**:\n    ```go\n    var variablename type = value\n    ```\n   - Used inside or outside functions.\n   - Declaration and assignment can be done separately.\n\n2. **Using `:=`**:\n    ```go\n    variablename := value\n    ```\n   - Used only inside functions.\n   - Declaration and assignment **must** be done on the same line.\n\n**Example:**\n\n```go\nvar a3, b3 = 6, \"Hello\"\nc3, d3 := 7, \"World!\"\nfmt.Println(a3, b3, c3, d3)\n```\n\n---\n\n### Grouped Variable Declarations\n\nVariables can also be declared together for better readability:\n\n```go\nfunc main() {\n   var (\n     a int\n     b int = 1\n     c string = \"hello\"\n   )\n   fmt.Println(a, b, c)\n}\n```\n\nSimilarly, constants can also be grouped together:\n\n```go\nconst (\n  A int = 1\n  B = 3.14\n  C = \"Hi!\"\n)\n```\n\n---\n\n### Data Types in Go\n\nGo supports several built-in types:\n\n- **Basic Types**: `int`, `float64`, `string`, `bool`\n- **Complex Types**: `array`, `struct`, `map`, `slice`\n- **Type Aliases**:\n  - `byte` – Alias for `uint8`\n  - `rune` – Alias for `int32`, representing Unicode code points.\n\n---\n\n### Go Constants\n\nConstants in Go are immutable (cannot be changed once assigned). There are two types of constants:\n\n1. **Typed Constants**:\n    ```go\n    const A int = 1\n    ```\n\n2. **Untyped Constants**:\n    ```go\n    const A = 1\n    ```\n\nConstants can also be grouped together:\n\n```go\nconst (\n  A int = 1\n  B = 3.14\n  C = \"Hi!\"\n)\n```\n\n---\n\n### Maps in Go\n\nMaps in Go are used to store key-value pairs:\n\n```go\nvar m map[string]int\n```\n\n- A map must be initialized using `make()` before adding values.\n  ```go\n  m := make(map[string]int)\n  ```\n- Maps behave like slices or pointers, meaning a nil map cannot be written to but can be read from.\n\n---\n\n### Channels in Go\n\nGo provides **channels** to allow goroutines to communicate with each other.\n\n- **Channel Declaration**: `ch := make(chan int)`\n- To send data into a channel: `ch \u003c- v`\n- To receive data from a channel: `v := \u003c- ch`\n\nExample of using channels with goroutines:\n\n```go\nfunc sum(s []int, c chan int) {\n    sum := 0\n    for _, v := range s {\n        sum += v\n    }\n    c \u003c- sum // send sum to channel c\n}\n\nfunc main() {\n    s := []int{7, 2, 8, -9, 4, 0}\n\n    c := make(chan int)\n    go sum(s[:len(s)/2], c)\n    go sum(s[len(s)/2:], c)\n    x, y := \u003c-c, \u003c-c // receive from channel\n\n    fmt.Println(x, y, x+y)\n}\n```\n\n**Explanation:**\n\n- **Goroutines** – Lightweight threads that run in parallel.\n- **Channels** – Used to pass data between goroutines safely.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famreshpro%2Fgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famreshpro%2Fgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famreshpro%2Fgo/lists"}