{"id":37216161,"url":"https://github.com/rwx-777/go_learning_repo","last_synced_at":"2026-01-15T00:59:41.013Z","repository":{"id":101373615,"uuid":"281102335","full_name":"rwx-777/Go_Learning_Repo","owner":"rwx-777","description":"This is my Go Learnig Repository for all fellow Go noobs. Focused on InfoSec.","archived":false,"fork":false,"pushed_at":"2020-08-07T14:53:51.000Z","size":47,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-03T11:19:08.766Z","etag":null,"topics":["blackhat","blackhatgo","cybersecurity","go","golang","infosec","learning-by-doing"],"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/rwx-777.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}},"created_at":"2020-07-20T11:50:43.000Z","updated_at":"2024-06-19T06:40:49.512Z","dependencies_parsed_at":null,"dependency_job_id":"c8f07f21-5994-46f6-a670-5d211aae0ae6","html_url":"https://github.com/rwx-777/Go_Learning_Repo","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/rwx-777/Go_Learning_Repo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwx-777%2FGo_Learning_Repo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwx-777%2FGo_Learning_Repo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwx-777%2FGo_Learning_Repo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwx-777%2FGo_Learning_Repo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwx-777","download_url":"https://codeload.github.com/rwx-777/Go_Learning_Repo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwx-777%2FGo_Learning_Repo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28441003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"ssl_error","status_checked_at":"2026-01-15T00:55:20.945Z","response_time":107,"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":["blackhat","blackhatgo","cybersecurity","go","golang","infosec","learning-by-doing"],"created_at":"2026-01-15T00:59:40.367Z","updated_at":"2026-01-15T00:59:40.999Z","avatar_url":"https://github.com/rwx-777.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go_Learning_Repo\nThis is my Go Learnig Repository for all fellow Go noobs. Focused on InfoSec.\n\n## Why Go ?\n- Cross Platform\n- Fast \n- Easy to write (lets see)\n\n## How to run and compile Go ?\n```\n$go run hello.go\n```\n\nwill execute the current programm without needing to compile it\n\nTo create a binary we need this command:\n```\n$go build hello.go\n```\nGo binaries are quite big by default we can use these parameters to make them smaller:\n```\n$go build -ldflags \"-w -s\"\n```\n## How do we cross compile in Go ?\n\nThis command will build an executable for linux 64 bit systems:\n```\n$GOOS=\"linux\" GOARCH=\"amd64\" go build hello.go\n```\nNice !\n\n### Other useful Go Commands\n\n- The \"go doc\" Command will show you Guidance Papers on any part of Go ($go doc fmt.Println )\n- The \"go get\" Command is an equivalent to python pip \n- The \"go fmt\" Command will format your code for you, by enforcing the use of proper line breaks, indentation and brace allignment \n- Last but not least the \"go vet\" Command which will do some heuristic stuff on your code and tell you why your code suckx :)\n\n## Go Syntax\n\n### Primitive Data Types\n\nprimitive types include: bool, string, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, uintptr, byte, rune, float32, float64, complex64, complex128\n\nDeclaring a variable:\n```\nvar x = \"Hello World\"\nor\ny := \"Hello World\"\n\nvar x = int(42)\nor \ny := int(42)\n```\n\n### Slices and Maps\nGo also has more complex data types like slices and maps.\nSlices are like arrays that you can dynamically resize and pass to fucntions.\nMaps are associative arrays, unordered lists of key/value pairs that lets you quickly look up values for a unique key.\n\nExample of a Slice:\n```\nvar s = make([]string, 0)\ns = append(s, \"hek\")\n```\n\nExample of a Map:\n```\nvar m = make(map[string]string)\nm[\"some key\"] = \"some value\"\n```\n\n### Pointers, Structs and Interfaces\nPointers in Go work like they do in C. We use the \u0026-operator to retrieve the memory address of some variable, and the * -operator to dereference the address.\n\nPointer Example:\n\n```\nvar count = int(42)\nvar ptr = \u0026count\nfmt.Println(ptr)  //prints memory address of count\nfmt.Println(*ptr) //prints the value of count\n*ptr = 100        //writes new value into count\nfmt.Println(count)\n```\n\nStruct Example:\n\n```\ntype Person struct {\n  Name string\n  Age int\n}\nfunc (p *Person) SayHello() {\n  fmt.Println(\"Hello,\", p.Name)\n}\nfunc main() {\n  var guy = new (Person)\n  guy.Name = \"Dave\"\n  guy.Age = 21\n  guy.SayHello()\n}\n```\n\nExample of a interface:\n\n```\ntype Friend interface {\n  SayHello()\n}\n\nfunc Greet (f Friend) {\n  f.SayHello()\n}\n\nfunc main() {\n  var guy = new (Person)\n  guy.Name = \"Gary\"\n  Greet(guy)\n```\n\n\n### Control Structures\n\nBasic If-else Statement\n```\nif z == 1 {\n\t\tfmt.Println(\"Z is equal to 1\")\n} else {\n\t\tfmt.Println(\"Z is not equal to 1\")\n}\n```\nBasic Switch Statement\n```\nvar x = \"foo\"\nswitch x {\n\tcase \"foo\":\n\t\tfmt.Println(\"found foo\")\n\tcase \"bar\":\n\t\tfmt.Println(\"Found bar\")\n\tdefault:\n\t\tfmt.Println(\"Default case\")\n}\n```\nGo doesnt hava a do or while loop. Only a for loop.\nFor Loop Example:\n```\nfor i := 0; i \u003c 10; i++ {\n  fmt.Println(i)\n}\n```\n\n### Concurrency - Goroutines\nTo exeucte code concurrently we can use *goroutines.*\nSome people call them lightweight threads, because the cost of creating then is minimal.\n\nExample:\n```\nfunc f() {\n\tfmt.Println(\"f function\")\n}\n\nfunc main() {\n\tgo f()\n\ttime.Sleep(1*time.Second)\n\tfmt.Println(\"main function\")\n}\n```\n\n\n### Error Handling\n\n\n```\ntype error interface {\n\tError() string\n}\n\n//Custom Error Message\ntype myError string\nfunc (e myError) Error() string {\n\treturn string(e)\n}\n```\n\nError handling pattern:\n```\nfunc foo() error {\n\treturn errors.New(\"Some Error Occured\")\n}\n\nfunc main() {\n\tif err := foo(); err != nil {\n\t//handle the error\n\t}\n}\n```\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwx-777%2Fgo_learning_repo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwx-777%2Fgo_learning_repo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwx-777%2Fgo_learning_repo/lists"}