{"id":17328988,"url":"https://github.com/weblancaster/go-studies","last_synced_at":"2025-08-07T02:14:36.843Z","repository":{"id":143210500,"uuid":"254582328","full_name":"weblancaster/go-studies","owner":"weblancaster","description":"Go lang studies","archived":false,"fork":false,"pushed_at":"2020-04-17T06:05:55.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-15T03:17:05.004Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weblancaster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-04-10T08:23:25.000Z","updated_at":"2024-06-19T10:06:39.314Z","dependencies_parsed_at":null,"dependency_job_id":"0c01c558-c6d2-4792-b19c-ed760311ada1","html_url":"https://github.com/weblancaster/go-studies","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/weblancaster/go-studies","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weblancaster%2Fgo-studies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weblancaster%2Fgo-studies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weblancaster%2Fgo-studies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weblancaster%2Fgo-studies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weblancaster","download_url":"https://codeload.github.com/weblancaster/go-studies/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weblancaster%2Fgo-studies/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269185726,"owners_count":24374634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-15T14:25:47.967Z","updated_at":"2025-08-07T02:14:36.762Z","avatar_url":"https://github.com/weblancaster.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- @format --\u003e\n\n## package main\n\n`package main` declaration is the first thing in a go file and its meant to tell go what is the workspace/project/package the file is part of. \\\nThe reason we have called `main` is because go has two types of packages, `executable` and `resusable`.\n\n**Executable:** \\\nIs when the code that is compiled and bundled as executable file. Must have a `func` called `main`.\n\n**Reusable:** \\\nAre packages that are used as dependencies and not generated as executable. One way to differ a resusable from executable is the by the `package main` declaration.\n\n## import\n\nimport is used to get code/access defined in another package\n\n## file pattern\n\nWe will always find this file pattern in go files.\n\n```\n// package declaration\npackage main\n\n// import required/needed packages\nimport (\"fmt\")\n\n// functions and whatnots to do things\nfunc main() {}\n```\n\n## pointers\n\nLet's say we have an instance of a struct called `person` which we have the field `name` with the value as `\"jon doe\"` and we try to change this value like so:\n\n```go\np := person{\n  name: \"jon doe\"\n}\np.name = \"new name\"\n```\n\nThe above code won't work because at the time of the instantiation we are saving/allocating in memory the person object with name and value, and then when trying to change the name although go won't through any errors we won't be changing the values/data in the original allocation of the person object.\n\nFor that we need to use pointer operators:\n\n`\u0026` Get the memory address where originally saved, example `pPointer := \u0026p` \\\n`*` Get the value of the memory address is pointing to, example `*pPointer`\n\nThat being said, Go will allow to omit the `\u0026` when the receiver is a pointer \"type\".\n\nWhen to think about the pointers being passed arround? when using value types such as `int`, `float`, `string`, `bool` and `structs`\n\n## channels\n\nChannels are a way to communicate between go routines, first we need to `make` a channel and pass the type of the messages (which can also be channels) `c := make(chan string)` then we need to pass the channel to the function that uses the go routine `go doSomethingFoo(c)` and finally use the channels by sending `c \u003c- \"some message\"` and receiving `\u003c- c`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweblancaster%2Fgo-studies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweblancaster%2Fgo-studies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweblancaster%2Fgo-studies/lists"}