{"id":20743657,"url":"https://github.com/tobychui/golang-oop-example","last_synced_at":"2026-04-18T23:05:44.900Z","repository":{"id":134125955,"uuid":"286477749","full_name":"tobychui/Golang-OOP-Example","owner":"tobychui","description":"A very basic example showcasing the use of go module and struct for OOP in Golang project","archived":false,"fork":false,"pushed_at":"2020-08-10T13:18:05.000Z","size":1103,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T02:25:51.472Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tobychui.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-08-10T13:06:10.000Z","updated_at":"2023-09-08T18:11:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"d9134892-5874-4869-9c03-89e5aaa26f64","html_url":"https://github.com/tobychui/Golang-OOP-Example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobychui%2FGolang-OOP-Example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobychui%2FGolang-OOP-Example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobychui%2FGolang-OOP-Example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobychui%2FGolang-OOP-Example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobychui","download_url":"https://codeload.github.com/tobychui/Golang-OOP-Example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243036038,"owners_count":20225652,"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","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-11-17T07:12:20.164Z","updated_at":"2025-12-24T23:04:16.418Z","avatar_url":"https://github.com/tobychui.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Golang-OOP-Example\nA very basic example showcasing the use of go module and struct for OOP in Golang project\n\n\n## Qestions you might want to ask\n\n1. Why the import module is \"GoOOP/demo/printer\" instead of just \"printer\" or \"Golang-OOP-Example/printer\"?\n\n\tIt is because this project is initialized with \n\t```\n\tgo mod init GoOOP/demo\n\t```\n\n2. Why the compiled binary is named \"demo.exe\" instead of the folder name \"Golang-OOP-Example.exe\"?\n\n\tIt is because this project is initialized with \n\t```\n\tgo mod init GoOOP/demo\n\t```\n\n\tand the go build command will use the last section of the module name as the binary executable name.\n\n\n3. If I am starting a new project, how can I name my module?\n\n\tUse the go mod command as follows.\n\n\t```\n\tgo mod init {your module name}\n\n\t/*\n\t\tExample of module names: \n\t\tgithub.com/tobychui/mymodule\n\t\tmydomain.com/mymodule\n\t\tanything/you/want\n\t\t\n\t*/ \n\n\tgo mod tidy\n\t```\n\n4. Why the module has to be initialize with ```p := printer.NewPrinter(\"Tim\")``` instead of other module name?\n\t\n\tYou can choose to import \"GoOOP/demo/printer\" with other names like\n\t```\n\t\timport (\n\t\t\tmagic \"GoOOP/demo/printer\"\n\t\t)\n\t```\n\t\n\tand call to the imported module using \n\t\n\t```\n\t\tp := magic.NewPrinter(\"Tim\")\n\t```\n\t\n\t\n## Questions?\n\nFeel free to open a new issue and I will add your Q\u0026A into the README.md file.\n\t\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobychui%2Fgolang-oop-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobychui%2Fgolang-oop-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobychui%2Fgolang-oop-example/lists"}